PerryCheng614 commited on
Commit
c783314
·
1 Parent(s): f19194b

initial app commit

Browse files
Files changed (1) hide show
  1. app.py +41 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import websockets
3
+ import asyncio
4
+ import json
5
+ import base64
6
+ from PIL import Image
7
+ import io
8
+
9
+ def process_image_stream(image, question, max_tokens):
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.Image(type="filepath", label="Upload Image"),
17
+ gr.Textbox(
18
+ label="Question",
19
+ placeholder="Ask a question about the image...",
20
+ value="Describe this image"
21
+ ),
22
+ gr.Slider(
23
+ minimum=50,
24
+ maximum=200,
25
+ value=200,
26
+ step=1,
27
+ label="Max Tokens"
28
+ )
29
+ ],
30
+ outputs=gr.Textbox(label="Response", interactive=False),
31
+ title="Nexa Omni Vision",
32
+ description=f"""
33
+ Model Repo: <a href="https://huggingface.co/NexaAIDev/omnivision-968M">NexaAIDev/omnivision-968M</a>
34
+
35
+ *Model updated on Nov 21, 2024\n
36
+ Upload an image and ask questions about it. The model will analyze the image and provide detailed answers to your queries.
37
+ """,
38
+ )
39
+
40
+ if __name__ == "__main__":
41
+ demo.queue().launch(server_name="0.0.0.0", server_port=7860)