Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,9 @@ import gradio as gr
|
|
2 |
|
3 |
from llavamed_inference_openvino import run_inference_image
|
4 |
|
|
|
|
|
|
|
5 |
|
6 |
def process_inputs(image, question):
|
7 |
if image is None:
|
@@ -15,20 +18,22 @@ def reset_inputs():
|
|
15 |
return None, "", ""
|
16 |
|
17 |
|
18 |
-
with gr.Blocks() as demo:
|
19 |
-
gr.Markdown("
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
text_input = gr.Textbox(label="Enter a Question")
|
24 |
|
25 |
-
output_text = gr.Textbox(label="Output", interactive=False)
|
26 |
|
27 |
with gr.Row():
|
28 |
process_button = gr.Button("Process")
|
29 |
reset_button = gr.Button("Reset")
|
|
|
|
|
|
|
|
|
30 |
process_button.click(process_inputs, inputs=[image_input, text_input], outputs=output_text)
|
31 |
reset_button.click(reset_inputs, inputs=[], outputs=[image_input, text_input, output_text])
|
32 |
|
33 |
-
|
34 |
demo.launch(server_port=7788)
|
|
|
2 |
|
3 |
from llavamed_inference_openvino import run_inference_image
|
4 |
|
5 |
+
css = """
|
6 |
+
.text textarea {font-size: 24px !important}
|
7 |
+
"""
|
8 |
|
9 |
def process_inputs(image, question):
|
10 |
if image is None:
|
|
|
18 |
return None, "", ""
|
19 |
|
20 |
|
21 |
+
with gr.Blocks(css=css) as demo:
|
22 |
+
gr.Markdown("# LLaVA-Med 1.5 OpenVINO Demo")
|
23 |
|
24 |
+
image_input = gr.Image(type="pil", label="Upload an Image", height=600, width=1000)
|
25 |
+
text_input = gr.Textbox(label="Enter a Question", elem_classes="text")
|
|
|
26 |
|
27 |
+
output_text = gr.Textbox(label="Output", interactive=False, elem_classes="text")
|
28 |
|
29 |
with gr.Row():
|
30 |
process_button = gr.Button("Process")
|
31 |
reset_button = gr.Button("Reset")
|
32 |
+
|
33 |
+
gr.Markdown("NOTE: This OpenVINO model is unvalidated. Results are provisional and may contain errors. Use this demo to explore AI PC and OpenVINO optimizations")
|
34 |
+
gr.Markdown("Source model: [microsoft/LLaVA-Med](https://github.com/microsoft/LLaVA-Med). For research purposes only.")
|
35 |
+
|
36 |
process_button.click(process_inputs, inputs=[image_input, text_input], outputs=output_text)
|
37 |
reset_button.click(reset_inputs, inputs=[], outputs=[image_input, text_input, output_text])
|
38 |
|
|
|
39 |
demo.launch(server_port=7788)
|