QuickLearnerAI commited on
Commit
c35d60a
·
verified ·
1 Parent(s): 3abcb23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -12
app.py CHANGED
@@ -1,17 +1,27 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
2
 
3
 
 
 
 
 
 
4
 
 
 
 
 
 
 
 
 
 
5
 
6
- gr.markdown("""
7
- ---
8
- ### About
9
- This application uses Microsoft's Phi-4-reasoning-plus model via OpenRouter for text-based problems
10
- and Llama-Vision-Free via Together AI for image-based problems.
11
- Your API keys are required but not stored permanently.
12
- """)
13
-
14
- #lunch the app
15
- if __name__=="__main__":
16
- demo = create_demo()
17
- demo.lunch()
 
1
  import gradio as gr
2
+ import os
3
+ import re
4
+ import time
5
+ import base64
6
+ from openai import OpenAI # access the open router api
7
+ from together import Together
8
+ from PIL import Image
9
+ import io
10
 
11
 
12
+ def math_solution_openrouter(api_key, prob_text, history=None):
13
+ if not api_key.strip():
14
+ return "please enter your OpenRouter Key.",history
15
+ if not prob_text.strip():
16
+ return "please enter a math problem so that I can solve it for you",
17
 
18
+ try:
19
+ client= OpenAI(
20
+ base_url="https://openrouter.ai/api/v1",
21
+ api_key=api_key,
22
+ )
23
+
24
+ except :
25
+
26
+
27