gptaibox commited on
Commit
c791143
1 Parent(s): 38c31b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -65,14 +65,14 @@ def text_prompt(request, system_role, page_url, api_key, temp):
65
 
66
  # clean the response text
67
  response_text = re.sub(r'\s+', ' ', response_text)
68
- response_text = f"#### [{page.title}]({page_url})\n\n{response_text.strip()}"
69
  total_tokens_str = str(total_tokens) + " (${:.2f} USD)".format(total_tokens/1000*0.002)
70
 
71
 
72
- return page.text, response_text, total_tokens_str
73
  except Exception as e:
74
- return page.text, f"--- An error occurred while processing the request: {e} ---", num_tokens
75
- return page.text, "--- Check API-Key or Min number of tokens:", str(num_tokens)
76
 
77
  # define the gradio interface
78
  iface = gr.Interface(
 
65
 
66
  # clean the response text
67
  response_text = re.sub(r'\s+', ' ', response_text)
68
+ response_text = f"#### [{page.title}]({article_url})\n\n{response_text.strip()}"
69
  total_tokens_str = str(total_tokens) + " (${:.2f} USD)".format(total_tokens/1000*0.002)
70
 
71
 
72
+ return article.text, response_text, total_tokens_str
73
  except Exception as e:
74
+ return article.text, f"--- An error occurred while processing the request: {e} ---", num_tokens
75
+ return article.text, "--- Check API-Key or Min number of tokens:", str(num_tokens)
76
 
77
  # define the gradio interface
78
  iface = gr.Interface(