Spaces:
Running
on
Zero
Running
on
Zero
Update chatbot.py
Browse files- chatbot.py +3 -1
chatbot.py
CHANGED
@@ -265,6 +265,7 @@ def fetch_and_extract(link, max_chars_per_page):
|
|
265 |
return {"link": link, "text": None}
|
266 |
|
267 |
def search(term, max_results=2, max_chars_per_page=8000, max_threads=10):
|
|
|
268 |
"""Performs a DuckDuckGo search and extracts text from webpages."""
|
269 |
all_results = []
|
270 |
result_block = DDGS().text(term, max_results=max_results)
|
@@ -277,6 +278,7 @@ def search(term, max_results=2, max_chars_per_page=8000, max_threads=10):
|
|
277 |
thread.start()
|
278 |
for thread in threads:
|
279 |
thread.join()
|
|
|
280 |
return all_results
|
281 |
|
282 |
# Format the prompt for the language model
|
@@ -305,7 +307,7 @@ def update_history(answer="", question=""):
|
|
305 |
return history
|
306 |
|
307 |
# Define a function for model inference
|
308 |
-
@spaces.GPU(duration=
|
309 |
def model_inference(
|
310 |
user_prompt,
|
311 |
chat_history,
|
|
|
265 |
return {"link": link, "text": None}
|
266 |
|
267 |
def search(term, max_results=2, max_chars_per_page=8000, max_threads=10):
|
268 |
+
gr.Info("Searching...")
|
269 |
"""Performs a DuckDuckGo search and extracts text from webpages."""
|
270 |
all_results = []
|
271 |
result_block = DDGS().text(term, max_results=max_results)
|
|
|
278 |
thread.start()
|
279 |
for thread in threads:
|
280 |
thread.join()
|
281 |
+
gr.Info("Extracting Important Info..")
|
282 |
return all_results
|
283 |
|
284 |
# Format the prompt for the language model
|
|
|
307 |
return history
|
308 |
|
309 |
# Define a function for model inference
|
310 |
+
@spaces.GPU(duration=45, queue=False)
|
311 |
def model_inference(
|
312 |
user_prompt,
|
313 |
chat_history,
|