Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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}]({
|
69 |
total_tokens_str = str(total_tokens) + " (${:.2f} USD)".format(total_tokens/1000*0.002)
|
70 |
|
71 |
|
72 |
-
return
|
73 |
except Exception as e:
|
74 |
-
return
|
75 |
-
return
|
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(
|