bowenchen118 commited on
Commit
acf6619
·
1 Parent(s): 2c1976e
Files changed (1) hide show
  1. app.py +24 -3
app.py CHANGED
@@ -1,9 +1,30 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  demo.launch()
8
 
9
  # import os
 
1
  import gradio as gr
2
 
3
+ def save_image(user_query, user_image):
4
+ """
5
+ Function to save the user-uploaded image and display the query.
6
+ """
7
+ # Save the image
8
+ user_image.save("user_image.jpg")
9
 
10
+ # Display the query
11
+ return f"Query: {user_query}"
12
+
13
+ # ========== Gradio Interface ==========
14
+ with gr.Blocks() as demo:
15
+ gr.Markdown("# 🧠 OctoTools AI Solver") # Title
16
+
17
+ with gr.Row():
18
+ user_query = gr.Textbox(label="Enter your query", placeholder="Type your question here...")
19
+ user_image = gr.Image(type="pil", label="Upload an image") # Accepts multiple formats
20
+
21
+ run_button = gr.Button("Run") # Run button
22
+ chatbot_output = gr.Chatbot(label="Problem-Solving Output")
23
+
24
+ # Link button click to function
25
+ run_button.click(fn=save_image, inputs=[user_query, user_image], outputs=chatbot_output)
26
+
27
+ # Launch the Gradio app
28
  demo.launch()
29
 
30
  # import os