Commit
·
76ffeab
1
Parent(s):
e54adbc
WIP
Browse files
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 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 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)
|