Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,22 +53,47 @@ def process_input(text, image=None):
|
|
| 53 |
return decoded_output
|
| 54 |
|
| 55 |
# Gradio Interface Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
def demo():
|
| 57 |
# Define Gradio input and output components
|
| 58 |
text_input = gr.Textbox(label="Text Input", placeholder="Enter text here", lines=5)
|
| 59 |
-
|
| 60 |
-
# Use type="pil" to work with PIL Image objects
|
| 61 |
image_input = gr.Image(label="Upload an Image", type="pil")
|
| 62 |
-
|
| 63 |
output = gr.Textbox(label="Model Output", lines=5)
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
# Define the interface layout
|
| 66 |
interface = gr.Interface(
|
| 67 |
fn=process_input,
|
| 68 |
inputs=[text_input, image_input],
|
| 69 |
outputs=output,
|
|
|
|
| 70 |
title="Llama 3.2 Multimodal Text-Image Analyzer",
|
| 71 |
-
description="Upload an image and/or provide text for analysis using the Llama 3.2 Vision Model."
|
| 72 |
)
|
| 73 |
|
| 74 |
# Launch the demo
|
|
|
|
| 53 |
return decoded_output
|
| 54 |
|
| 55 |
# Gradio Interface Setup
|
| 56 |
+
# def demo():
|
| 57 |
+
# # Define Gradio input and output components
|
| 58 |
+
# text_input = gr.Textbox(label="Text Input", placeholder="Enter text here", lines=5)
|
| 59 |
+
|
| 60 |
+
# # Use type="pil" to work with PIL Image objects
|
| 61 |
+
# image_input = gr.Image(label="Upload an Image", type="pil")
|
| 62 |
+
|
| 63 |
+
# output = gr.Textbox(label="Model Output", lines=5)
|
| 64 |
+
|
| 65 |
+
# # Define the interface layout
|
| 66 |
+
# interface = gr.Interface(
|
| 67 |
+
# fn=process_input,
|
| 68 |
+
# inputs=[text_input, image_input],
|
| 69 |
+
# outputs=output,
|
| 70 |
+
# title="Llama 3.2 Multimodal Text-Image Analyzer",
|
| 71 |
+
# description="Upload an image and/or provide text for analysis using the Llama 3.2 Vision Model."
|
| 72 |
+
# )
|
| 73 |
+
|
| 74 |
+
# # Launch the demo
|
| 75 |
+
# interface.launch()
|
| 76 |
+
|
| 77 |
def demo():
|
| 78 |
# Define Gradio input and output components
|
| 79 |
text_input = gr.Textbox(label="Text Input", placeholder="Enter text here", lines=5)
|
|
|
|
|
|
|
| 80 |
image_input = gr.Image(label="Upload an Image", type="pil")
|
|
|
|
| 81 |
output = gr.Textbox(label="Model Output", lines=5)
|
| 82 |
|
| 83 |
+
# Add two examples for multimodal analysis
|
| 84 |
+
examples = [
|
| 85 |
+
["The llama is ", "./examples/rococo.jpg"],
|
| 86 |
+
["The cute hampster is wearing ", "./examples/weather_events.png"]
|
| 87 |
+
]
|
| 88 |
+
|
| 89 |
# Define the interface layout
|
| 90 |
interface = gr.Interface(
|
| 91 |
fn=process_input,
|
| 92 |
inputs=[text_input, image_input],
|
| 93 |
outputs=output,
|
| 94 |
+
examples=examples,
|
| 95 |
title="Llama 3.2 Multimodal Text-Image Analyzer",
|
| 96 |
+
description="Upload an image and/or provide text for analysis using the Llama 3.2 Vision Model. You can also try out the provided examples.",
|
| 97 |
)
|
| 98 |
|
| 99 |
# Launch the demo
|