Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -77,24 +77,25 @@ After writing the document, please provide a list of sources used in your respon
|
|
77 |
else:
|
78 |
return f"Error: API returned status code {response.status_code}", ""
|
79 |
|
80 |
-
def
|
81 |
-
main_content, sources = get_response_with_search(
|
82 |
formatted_response = f"{main_content}\n\nSources:\n{sources}"
|
83 |
return formatted_response
|
84 |
|
85 |
-
# Gradio interface
|
86 |
-
iface = gr.
|
87 |
-
fn=
|
88 |
-
inputs=gr.Textbox(lines=2, placeholder="Enter your question here..."),
|
89 |
-
outputs="text",
|
90 |
title="AI-powered Web Search Assistant",
|
91 |
-
description="Ask
|
92 |
examples=[
|
93 |
-
["
|
94 |
-
["
|
95 |
-
["
|
96 |
-
["
|
97 |
-
]
|
|
|
|
|
|
|
98 |
)
|
99 |
|
100 |
if __name__ == "__main__":
|
|
|
77 |
else:
|
78 |
return f"Error: API returned status code {response.status_code}", ""
|
79 |
|
80 |
+
def chatbot_interface(message, history):
|
81 |
+
main_content, sources = get_response_with_search(message)
|
82 |
formatted_response = f"{main_content}\n\nSources:\n{sources}"
|
83 |
return formatted_response
|
84 |
|
85 |
+
# Gradio chatbot interface
|
86 |
+
iface = gr.ChatInterface(
|
87 |
+
fn=chatbot_interface,
|
|
|
|
|
88 |
title="AI-powered Web Search Assistant",
|
89 |
+
description="Ask questions, and I'll search the web and provide answers using the Mistral-7B-Instruct model.",
|
90 |
examples=[
|
91 |
+
["What are the latest developments in AI?"],
|
92 |
+
["Tell me about recent updates on GitHub"],
|
93 |
+
["What are the best hotels in Galapagos, Ecuador?"],
|
94 |
+
["Summarize recent advancements in Python programming"],
|
95 |
+
],
|
96 |
+
retry_btn="Retry",
|
97 |
+
undo_btn="Undo",
|
98 |
+
clear_btn="Clear",
|
99 |
)
|
100 |
|
101 |
if __name__ == "__main__":
|