PerryCheng614 commited on
Commit
76ffeab
·
1 Parent(s): e54adbc
Files changed (1) hide show
  1. app.py +28 -18
app.py CHANGED
@@ -6,32 +6,42 @@ import base64
6
  from PIL import Image
7
  import io
8
 
 
 
 
 
 
 
 
 
9
  def process_image_stream(question):
10
  return "This is a test response"
11
 
12
- # Create Gradio interface
13
- demo = gr.Interface(
14
- fn=process_image_stream,
15
- inputs=[
16
- gr.Textbox(
 
 
 
 
17
  label="Question",
18
  placeholder="Ask a question about the image...",
19
  value="Describe this image",
20
  scale=1, # Makes the textbox responsive
21
  min_width=300 # Minimum width on mobile
22
- ),
23
- ],
24
- outputs=gr.Textbox(
25
- label="Response",
26
- interactive=False,
27
- scale=1, # Makes the textbox responsive
28
- min_width=300 # Minimum width on mobile
29
- ),
30
- title="Nexa Omni Vision",
31
- theme="soft", # Using a mobile-friendly theme
32
- css=".gradio-container {max-width: 800px; margin: auto}", # Responsive container
33
- allow_flagging="never" # Removes flagging button for cleaner mobile view
34
- )
35
 
36
  if __name__ == "__main__":
37
  demo.queue().launch(server_name="0.0.0.0", server_port=7860)
 
6
  from PIL import Image
7
  import io
8
 
9
+ # Add custom CSS for mobile responsiveness
10
+ css = '''
11
+ .row {
12
+ width: 90%;
13
+ margin: auto;
14
+ }
15
+ '''
16
+
17
  def process_image_stream(question):
18
  return "This is a test response"
19
 
20
+ # Create Gradio interface with mobile-friendly settings
21
+ demo = gr.Blocks(css=css, theme="soft") # Using Blocks instead of Interface for more flexibility
22
+
23
+ with demo:
24
+ with gr.Row(elem_classes="row"):
25
+ gr.Markdown("# Nexa Omni Vision")
26
+
27
+ with gr.Row(elem_classes="row"):
28
+ question = gr.Textbox(
29
  label="Question",
30
  placeholder="Ask a question about the image...",
31
  value="Describe this image",
32
  scale=1, # Makes the textbox responsive
33
  min_width=300 # Minimum width on mobile
34
+ )
35
+
36
+ with gr.Row(elem_classes="row"):
37
+ response = gr.Textbox(
38
+ label="Response",
39
+ interactive=False,
40
+ scale=1,
41
+ min_width=300
42
+ )
43
+
44
+ question.submit(fn=process_image_stream, inputs=question, outputs=response)
 
 
45
 
46
  if __name__ == "__main__":
47
  demo.queue().launch(server_name="0.0.0.0", server_port=7860)