Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,11 +14,11 @@ def generate_caption(image):
|
|
| 14 |
caption = processor.decode(out[0], skip_special_tokens=True)
|
| 15 |
return caption
|
| 16 |
|
| 17 |
-
# Example images from your Hugging Face Space
|
| 18 |
example_images = [
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
]
|
| 23 |
|
| 24 |
# Create the Gradio interface
|
|
@@ -29,7 +29,7 @@ with gr.Blocks() as demo:
|
|
| 29 |
with gr.Row():
|
| 30 |
with gr.Column():
|
| 31 |
image_input = gr.Image(type="pil", label="Upload an Image or Select an Example")
|
| 32 |
-
|
| 33 |
|
| 34 |
with gr.Column():
|
| 35 |
caption_output = gr.Textbox(label="Generated Caption")
|
|
@@ -39,4 +39,4 @@ with gr.Blocks() as demo:
|
|
| 39 |
generate_button.click(fn=generate_caption, inputs=image_input, outputs=caption_output)
|
| 40 |
|
| 41 |
# Launch the app
|
| 42 |
-
demo.launch()
|
|
|
|
| 14 |
caption = processor.decode(out[0], skip_special_tokens=True)
|
| 15 |
return caption
|
| 16 |
|
| 17 |
+
# Example images from your Hugging Face Space (replace with actual file paths)
|
| 18 |
example_images = [
|
| 19 |
+
"example1.jpg",
|
| 20 |
+
"example2.jpg",
|
| 21 |
+
"example3.jpg"
|
| 22 |
]
|
| 23 |
|
| 24 |
# Create the Gradio interface
|
|
|
|
| 29 |
with gr.Row():
|
| 30 |
with gr.Column():
|
| 31 |
image_input = gr.Image(type="pil", label="Upload an Image or Select an Example")
|
| 32 |
+
gr.Examples(examples=example_images, inputs=image_input)
|
| 33 |
|
| 34 |
with gr.Column():
|
| 35 |
caption_output = gr.Textbox(label="Generated Caption")
|
|
|
|
| 39 |
generate_button.click(fn=generate_caption, inputs=image_input, outputs=caption_output)
|
| 40 |
|
| 41 |
# Launch the app
|
| 42 |
+
demo.launch()
|