Update app.py
Browse files
app.py
CHANGED
@@ -4,38 +4,54 @@ from llm_handler import sanchaari
|
|
4 |
def handle_query(query):
|
5 |
thoughts = []
|
6 |
final_answer = None
|
7 |
-
|
8 |
for result in sanchaari(query):
|
9 |
if "thought" in result:
|
10 |
thoughts.append(result["thought"])
|
11 |
-
yield {"Thought Process": thoughts, "Response Text": ""}
|
12 |
if "final_answer" in result:
|
13 |
final_answer = result["final_answer"]
|
14 |
-
yield {"Thought Process": thoughts, "Response Text": final_answer}
|
15 |
-
|
16 |
-
gr.Interface(
|
17 |
-
fn=handle_query,
|
18 |
-
inputs=gr.Textbox(lines=2, placeholder="Enter your query here..."),
|
19 |
-
outputs="json",
|
20 |
-
title="Antarjaala Sanchaari: Your Versatile AI Assistant",
|
21 |
-
description=""" Meet **Antarjaala Sanchaari**, your versatile AI assistant designed to provide quick and accurate information on various topics. Whether you need to know the latest stock prices, definitions of complex words, or even translations, **Sanchaari** is here to help. With capabilities to fetch real-time data, perform calculations, and retrieve information from Wikipedia, **Sanchaari** is your go-to source for all your informational needs. Explore the power of AI with **Sanchaari**, your intelligent companion for insightful answers and seamless assistance.
|
22 |
-
|
23 |
-
**What Sanchaari Can Do:**
|
24 |
-
- **Calculate**: Perform arithmetic calculations.
|
25 |
-
- **Find Information**: Search and summarize information from Wikipedia.
|
26 |
-
- **Tell Time**: Get the current time for any location worldwide.
|
27 |
-
- **Get Stock Prices**: Check current stock prices for any company.
|
28 |
-
- **Define Words**: Look up definitions for any word.
|
29 |
-
- **Provide Latest News**: Retrieve the latest news headlines.
|
30 |
-
- **Translate Text**: Translate text from English to various languages.
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
**Answer**: 6
|
40 |
-
"""
|
41 |
-
).launch(share=True)
|
|
|
4 |
def handle_query(query):
|
5 |
thoughts = []
|
6 |
final_answer = None
|
|
|
7 |
for result in sanchaari(query):
|
8 |
if "thought" in result:
|
9 |
thoughts.append(result["thought"])
|
10 |
+
yield {"Thought Process": "\n".join(thoughts), "Response Text": ""}
|
11 |
if "final_answer" in result:
|
12 |
final_answer = result["final_answer"]
|
13 |
+
yield {"Thought Process": "\n".join(thoughts), "Response Text": final_answer}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
with gr.Blocks(css="footer {visibility: hidden}") as demo:
|
16 |
+
gr.Markdown(
|
17 |
+
"""
|
18 |
+
# Antarjaala Sanchaari: Your Versatile AI Assistant
|
19 |
+
|
20 |
+
Meet **Antarjaala Sanchaari**, your intelligent companion for insightful answers and seamless assistance.
|
21 |
+
"""
|
22 |
+
)
|
23 |
+
|
24 |
+
with gr.Row():
|
25 |
+
with gr.Column(scale=2):
|
26 |
+
query_input = gr.Textbox(
|
27 |
+
lines=3,
|
28 |
+
placeholder="Enter your query here...",
|
29 |
+
label="Your Question"
|
30 |
+
)
|
31 |
+
submit_btn = gr.Button("Ask Sanchaari", variant="primary")
|
32 |
+
|
33 |
+
with gr.Column(scale=3):
|
34 |
+
output = gr.JSON(label="Sanchaari's Response")
|
35 |
+
|
36 |
+
gr.Markdown(
|
37 |
+
"""
|
38 |
+
### What Sanchaari Can Do:
|
39 |
+
- **Calculate**: Perform arithmetic calculations
|
40 |
+
- **Find Information**: Search and summarize information from Wikipedia
|
41 |
+
- **Tell Time**: Get the current time for any location worldwide
|
42 |
+
- **Get Stock Prices**: Check current stock prices for any company
|
43 |
+
- **Define Words**: Look up definitions for any word
|
44 |
+
- **Provide Latest News**: Retrieve the latest news headlines
|
45 |
+
- **Translate Text**: Translate text from English to various languages
|
46 |
+
|
47 |
+
### Example Questions:
|
48 |
+
1. What is the capital of France?
|
49 |
+
2. Calculate 2*3
|
50 |
+
3. Define "serendipity"
|
51 |
+
4. Translate "Hello, how are you?" to Spanish
|
52 |
+
"""
|
53 |
+
)
|
54 |
+
|
55 |
+
submit_btn.click(handle_query, inputs=query_input, outputs=output)
|
56 |
|
57 |
+
demo.launch(share=True)
|
|
|
|
|
|