Daryl Lim commited on
Commit
802f3ff
·
1 Parent(s): 9d456e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -6,7 +6,7 @@ The interface allows users to upload an image and receive a caption.
6
  import gradio as gr
7
  import spaces
8
  import torch
9
- from transformers import Blip2Processor, Blip2ForConditionalGeneration, BitsAndBytesConfig
10
  from PIL import Image
11
 
12
  # Define device
@@ -61,14 +61,14 @@ def caption_image(image: Image.Image) -> str:
61
 
62
  # Constants for Gradio interface configuration
63
  IMAGE_TYPE = "pil"
64
- OUTPUT_TYPE = "text"
65
 
66
  # Define the Gradio interface for image captioning
67
  demo = gr.Interface(
68
  fn=caption_image,
69
  inputs=gr.Image(type=IMAGE_TYPE),
70
  outputs=OUTPUT_TYPE,
71
- title="Image Captioning with BLIP",
72
  description="Upload an image to generate a caption."
73
  )
74
 
 
6
  import gradio as gr
7
  import spaces
8
  import torch
9
+ from transformers import Blip2Processor, Blip2ForConditionalGeneration
10
  from PIL import Image
11
 
12
  # Define device
 
61
 
62
  # Constants for Gradio interface configuration
63
  IMAGE_TYPE = "pil"
64
+ OUTPUT_TYPE = gr.Textbox(label="Caption")
65
 
66
  # Define the Gradio interface for image captioning
67
  demo = gr.Interface(
68
  fn=caption_image,
69
  inputs=gr.Image(type=IMAGE_TYPE),
70
  outputs=OUTPUT_TYPE,
71
+ title="Image Captioning with BLIP-2",
72
  description="Upload an image to generate a caption."
73
  )
74