Update app.py
Browse files
app.py
CHANGED
@@ -87,10 +87,10 @@ def generate_response(user_message, max_tokens, temperature, top_p, history_stat
|
|
87 |
yield new_history, new_history
|
88 |
|
89 |
example_messages = {
|
90 |
-
"JEE Main 2025
|
91 |
-
"JEE Main 2025
|
92 |
-
"JEE Main 2025
|
93 |
-
"JEE Main 2025
|
94 |
}
|
95 |
|
96 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
@@ -131,10 +131,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
131 |
clear_button = gr.Button("Clear", scale=1)
|
132 |
gr.Markdown("**Try these examples:**")
|
133 |
with gr.Row():
|
134 |
-
example1_button = gr.Button("JEE Main 2025
|
135 |
-
example2_button = gr.Button("JEE Main 2025
|
136 |
-
example3_button = gr.Button("JEE Main 2025
|
137 |
-
example4_button = gr.Button("JEE Main 2025
|
138 |
|
139 |
def update_conversation_list():
|
140 |
return [conversations[cid]["title"] for cid in conversations]
|
@@ -152,7 +152,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
152 |
|
153 |
def send_message(user_message, max_tokens, temperature, top_p, convo_id, history):
|
154 |
if convo_id not in conversations:
|
155 |
-
title = user_message.strip().split("\n")[0][:40]
|
|
|
156 |
conversations[convo_id] = {"title": title, "messages": history}
|
157 |
if conversations[convo_id]["title"].startswith("New Conversation"):
|
158 |
#conversations[convo_id]["title"] = user_message.strip().split("\n")[0][:40]
|
@@ -189,9 +190,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
189 |
outputs=[current_convo_id, history_state, chatbot]
|
190 |
)
|
191 |
|
192 |
-
example1_button.click(fn=lambda: gr.update(value=example_messages["JEE Main 2025
|
193 |
-
example2_button.click(fn=lambda: gr.update(value=example_messages["JEE Main 2025
|
194 |
-
example3_button.click(fn=lambda: gr.update(value=example_messages["JEE Main 2025
|
195 |
-
example4_button.click(fn=lambda: gr.update(value=example_messages["JEE Main 2025
|
196 |
|
197 |
demo.launch(share=True, ssr_mode=False)
|
|
|
87 |
yield new_history, new_history
|
88 |
|
89 |
example_messages = {
|
90 |
+
"JEE Main 2025 Combinatorics": "From all the English alphabets, five letters are chosen and are arranged in alphabetical order. The total number of ways, in which the middle letter is 'M', is?",
|
91 |
+
"JEE Main 2025 Coordinate Geometry": "A circle \\(C\\) of radius 2 lies in the second quadrant and touches both the coordinate axes. Let \\(r\\) be the radius of a circle that has centre at the point \\((2, 5)\\) and intersects the circle \\(C\\) at exactly two points. If the set of all possible values of \\(r\\) is the interval \\((\\alpha, \\beta)\\), then \\(3\\beta - 2\\alpha\\) is?",
|
92 |
+
"JEE Main 2025 Probability & Statistics": "A coin is tossed three times. Let \(X\) denote the number of times a tail follows a head. If \\(\\mu\\) and \\(\\sigma^2\\) denote the mean and variance of \\(X\\), then the value of \\(64(\\mu + \\sigma^2)\\) is?",
|
93 |
+
"JEE Main 2025 Laws of Motion": "A massless spring gets elongated by amount x_1 under a tension of 5 N . Its elongation is x_2 under the tension of 7 N . For the elongation of 5x_1 - 2x_2 , the tension in the spring will be?"
|
94 |
}
|
95 |
|
96 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
|
131 |
clear_button = gr.Button("Clear", scale=1)
|
132 |
gr.Markdown("**Try these examples:**")
|
133 |
with gr.Row():
|
134 |
+
example1_button = gr.Button("JEE Main 2025\nCombinatorics")
|
135 |
+
example2_button = gr.Button("JEE Main 2025\nCoordinate Geometry")
|
136 |
+
example3_button = gr.Button("JEE Main 2025\nProbability & Statistics")
|
137 |
+
example4_button = gr.Button("JEE Main 2025\nLaws of Motion")
|
138 |
|
139 |
def update_conversation_list():
|
140 |
return [conversations[cid]["title"] for cid in conversations]
|
|
|
152 |
|
153 |
def send_message(user_message, max_tokens, temperature, top_p, convo_id, history):
|
154 |
if convo_id not in conversations:
|
155 |
+
#title = user_message.strip().split("\n")[0][:40]
|
156 |
+
title = " ".join(user_message.strip().split()[:5])
|
157 |
conversations[convo_id] = {"title": title, "messages": history}
|
158 |
if conversations[convo_id]["title"].startswith("New Conversation"):
|
159 |
#conversations[convo_id]["title"] = user_message.strip().split("\n")[0][:40]
|
|
|
190 |
outputs=[current_convo_id, history_state, chatbot]
|
191 |
)
|
192 |
|
193 |
+
example1_button.click(fn=lambda: gr.update(value=example_messages["JEE Main 2025 Combinatorics"]), inputs=None, outputs=user_input)
|
194 |
+
example2_button.click(fn=lambda: gr.update(value=example_messages["JEE Main 2025 Coordinate Geometry"]), inputs=None, outputs=user_input)
|
195 |
+
example3_button.click(fn=lambda: gr.update(value=example_messages["JEE Main 2025 Probability & Statistics"]), inputs=None, outputs=user_input)
|
196 |
+
example4_button.click(fn=lambda: gr.update(value=example_messages["JEE Main 2025 Laws of Motion"]), inputs=None, outputs=user_input)
|
197 |
|
198 |
demo.launch(share=True, ssr_mode=False)
|