Shreyas094 commited on
Commit
7f18930
1 Parent(s): 1be55ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -13
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 gradio_interface(query):
81
- main_content, sources = get_response_with_search(query)
82
  formatted_response = f"{main_content}\n\nSources:\n{sources}"
83
  return formatted_response
84
 
85
- # Gradio interface
86
- iface = gr.Interface(
87
- fn=gradio_interface,
88
- inputs=gr.Textbox(lines=2, placeholder="Enter your question here..."),
89
- outputs="text",
90
  title="AI-powered Web Search Assistant",
91
- description="Ask a question, and I'll search the web and provide an answer using the Mistral-7B-Instruct model.",
92
  examples=[
93
- ["Latest news about Yann LeCun"],
94
- ["Latest news site:github.blog"],
95
- ["Where I can find best hotel in Galapagos, Ecuador intitle:hotel"],
96
- ["filetype:pdf intitle:python"]
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__":