Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,7 +93,10 @@ def fetch_response(prompt, enable_web_search):
|
|
| 93 |
if enable_web_search:
|
| 94 |
# Perform web search and generate text based on the retrieved results
|
| 95 |
web_results = search(prompt)
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
| 97 |
logging.debug(f"Formatted web search results: {web2}")
|
| 98 |
|
| 99 |
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.3")
|
|
|
|
| 93 |
if enable_web_search:
|
| 94 |
# Perform web search and generate text based on the retrieved results
|
| 95 |
web_results = search(prompt)
|
| 96 |
+
if not web_results:
|
| 97 |
+
web2 = "No results found."
|
| 98 |
+
else:
|
| 99 |
+
web2 = ' '.join([f"Link: {res['link']}\nText: {res['text']}\n\n" for res in web_results if res['text']])
|
| 100 |
logging.debug(f"Formatted web search results: {web2}")
|
| 101 |
|
| 102 |
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.3")
|