Commit ·
0403367
1
Parent(s): 76ffeab
WIP
Browse files
app.py
CHANGED
|
@@ -6,39 +6,48 @@ import base64
|
|
| 6 |
from PIL import Image
|
| 7 |
import io
|
| 8 |
|
| 9 |
-
#
|
| 10 |
css = '''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
.row {
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
}
|
| 15 |
'''
|
| 16 |
|
| 17 |
def process_image_stream(question):
|
| 18 |
return "This is a test response"
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
demo = gr.Blocks(css=css, theme="soft")
|
| 22 |
|
| 23 |
with demo:
|
| 24 |
-
with gr.
|
| 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 |
-
|
| 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 |
-
|
| 41 |
-
min_width=300
|
| 42 |
)
|
| 43 |
|
| 44 |
question.submit(fn=process_image_stream, inputs=question, outputs=response)
|
|
|
|
| 6 |
from PIL import Image
|
| 7 |
import io
|
| 8 |
|
| 9 |
+
# Updated CSS for better mobile responsiveness
|
| 10 |
css = '''
|
| 11 |
+
.container {
|
| 12 |
+
max-width: 100% !important;
|
| 13 |
+
padding: 1rem !important;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
.row {
|
| 17 |
+
flex-direction: column !important;
|
| 18 |
+
gap: 1rem !important;
|
| 19 |
+
margin: 0 auto !important;
|
| 20 |
+
padding: 0.5rem !important;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/* Make textboxes full width on mobile */
|
| 24 |
+
.input-box, .output-box {
|
| 25 |
+
width: 100% !important;
|
| 26 |
+
min-width: 100% !important;
|
| 27 |
}
|
| 28 |
'''
|
| 29 |
|
| 30 |
def process_image_stream(question):
|
| 31 |
return "This is a test response"
|
| 32 |
|
| 33 |
+
# Updated Gradio interface
|
| 34 |
+
demo = gr.Blocks(css=css, theme="soft")
|
| 35 |
|
| 36 |
with demo:
|
| 37 |
+
with gr.Column(): # Changed from Row to Column for better mobile layout
|
| 38 |
gr.Markdown("# Nexa Omni Vision")
|
| 39 |
+
|
|
|
|
| 40 |
question = gr.Textbox(
|
| 41 |
label="Question",
|
| 42 |
placeholder="Ask a question about the image...",
|
| 43 |
value="Describe this image",
|
| 44 |
+
elem_classes="input-box" # Added class for CSS targeting
|
|
|
|
| 45 |
)
|
| 46 |
+
|
|
|
|
| 47 |
response = gr.Textbox(
|
| 48 |
label="Response",
|
| 49 |
interactive=False,
|
| 50 |
+
elem_classes="output-box" # Added class for CSS targeting
|
|
|
|
| 51 |
)
|
| 52 |
|
| 53 |
question.submit(fn=process_image_stream, inputs=question, outputs=response)
|