|
import gradio as gr |
|
import websockets |
|
import asyncio |
|
import json |
|
import base64 |
|
from PIL import Image |
|
import io |
|
|
|
def process_image_stream(image, question, max_tokens): |
|
return "This is a test response" |
|
|
|
|
|
demo = gr.Interface( |
|
fn=process_image_stream, |
|
inputs=[ |
|
gr.Image(type="filepath", label="Upload Image"), |
|
gr.Textbox( |
|
label="Question", |
|
placeholder="Ask a question about the image...", |
|
value="Describe this image" |
|
), |
|
gr.Slider( |
|
minimum=50, |
|
maximum=200, |
|
value=200, |
|
step=1, |
|
label="Max Tokens" |
|
) |
|
], |
|
outputs=gr.Textbox(label="Response", interactive=False), |
|
title="Nexa Omni Vision", |
|
description=f""" |
|
Model Repo: <a href="https://huggingface.co/NexaAIDev/omnivision-968M">NexaAIDev/omnivision-968M</a> |
|
|
|
*Model updated on Nov 21, 2024\n |
|
Upload an image and ask questions about it. The model will analyze the image and provide detailed answers to your queries. |
|
""", |
|
) |
|
|
|
if __name__ == "__main__": |
|
demo.queue().launch(server_name="0.0.0.0", server_port=7860) |