umarigan commited on
Commit
a8cd252
·
verified ·
1 Parent(s): 2252e8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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
- ("image.jpg", "Example 1"),
20
- ("image1.jpg", "Example 2"),
21
- ("image2.jpg", "Example 3")
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
- examples = gr.Examples(examples=example_images, inputs=image_input)
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()