Update app.py
Browse files
app.py
CHANGED
|
@@ -140,7 +140,7 @@ def gen_math_sol_together(api_key, prob_text, img_path=None, history=None):
|
|
| 140 |
response = client.chat.completions.create(
|
| 141 |
model= "meta-llama/Llama-Vision-Free",
|
| 142 |
message= messages,
|
| 143 |
-
|
| 144 |
)
|
| 145 |
solution= response.choices[0].message.content
|
| 146 |
|
|
@@ -168,7 +168,7 @@ def create_demo():
|
|
| 168 |
with gr.Row():
|
| 169 |
with gr.Column(Scale=1): #left side
|
| 170 |
openrouter_api_key= gr.Textbox(
|
| 171 |
-
label= "
|
| 172 |
placeholder= "enter your API key here",
|
| 173 |
type= "password"
|
| 174 |
)
|
|
@@ -196,18 +196,19 @@ def create_demo():
|
|
| 196 |
|
| 197 |
openrouter_conversation_history= gr.State(value=None)
|
| 198 |
openrouter_submit_btn.click(
|
| 199 |
-
fn=
|
| 200 |
-
inputs=
|
| 201 |
outputs=[openrouter_solution_output, openrouter_conversation_history]
|
| 202 |
)
|
| 203 |
|
|
|
|
| 204 |
openrouter_clear_btn.click(
|
| 205 |
fn=lambda: ("",None),
|
| 206 |
inputs=[],
|
| 207 |
outputs=[openrouter_solution_output, openrouter_conversation_history]
|
| 208 |
)
|
| 209 |
|
| 210 |
-
with gr.TabItem("Text problem solver (
|
| 211 |
with gr.Row():
|
| 212 |
with gr.Column(Scale=1): #left side
|
| 213 |
together_api_key= gr.Textbox(
|
|
|
|
| 140 |
response = client.chat.completions.create(
|
| 141 |
model= "meta-llama/Llama-Vision-Free",
|
| 142 |
message= messages,
|
| 143 |
+
stream= False
|
| 144 |
)
|
| 145 |
solution= response.choices[0].message.content
|
| 146 |
|
|
|
|
| 168 |
with gr.Row():
|
| 169 |
with gr.Column(Scale=1): #left side
|
| 170 |
openrouter_api_key= gr.Textbox(
|
| 171 |
+
label= "OpenRouter API key",
|
| 172 |
placeholder= "enter your API key here",
|
| 173 |
type= "password"
|
| 174 |
)
|
|
|
|
| 196 |
|
| 197 |
openrouter_conversation_history= gr.State(value=None)
|
| 198 |
openrouter_submit_btn.click(
|
| 199 |
+
fn=math_solution_openrouter,
|
| 200 |
+
inputs=[openrouter_api_key, text_prob_input, openrouter_conversation_history],
|
| 201 |
outputs=[openrouter_solution_output, openrouter_conversation_history]
|
| 202 |
)
|
| 203 |
|
| 204 |
+
|
| 205 |
openrouter_clear_btn.click(
|
| 206 |
fn=lambda: ("",None),
|
| 207 |
inputs=[],
|
| 208 |
outputs=[openrouter_solution_output, openrouter_conversation_history]
|
| 209 |
)
|
| 210 |
|
| 211 |
+
with gr.TabItem("Text problem solver (Together AI)"):
|
| 212 |
with gr.Row():
|
| 213 |
with gr.Column(Scale=1): #left side
|
| 214 |
together_api_key= gr.Textbox(
|