File size: 1,222 Bytes
c783314
 
 
 
 
 
 
 
76ffeab
 
 
 
 
 
 
 
e54adbc
c783314
 
76ffeab
 
 
 
 
 
 
 
 
c783314
 
e54adbc
 
 
76ffeab
 
 
 
 
 
 
 
 
 
 
c783314
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import gradio as gr
import websockets
import asyncio
import json
import base64
from PIL import Image
import io

# Add custom CSS for mobile responsiveness
css = '''
.row {
    width: 90%;
    margin: auto;
}
'''

def process_image_stream(question):
    return "This is a test response"

# Create Gradio interface with mobile-friendly settings
demo = gr.Blocks(css=css, theme="soft") # Using Blocks instead of Interface for more flexibility

with demo:
    with gr.Row(elem_classes="row"):
        gr.Markdown("# Nexa Omni Vision")
    
    with gr.Row(elem_classes="row"):
        question = gr.Textbox(
            label="Question", 
            placeholder="Ask a question about the image...",
            value="Describe this image",
            scale=1,  # Makes the textbox responsive
            min_width=300  # Minimum width on mobile
        )
    
    with gr.Row(elem_classes="row"):
        response = gr.Textbox(
            label="Response", 
            interactive=False,
            scale=1,
            min_width=300
        )
    
    question.submit(fn=process_image_stream, inputs=question, outputs=response)

if __name__ == "__main__":
    demo.queue().launch(server_name="0.0.0.0", server_port=7860)