turtlegraphics commited on
Commit
bc51b68
·
verified ·
1 Parent(s): 4673364

Pick out the text.

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -7,7 +7,9 @@ from transformers import pipeline
7
  pipe = pipeline("image-to-text", model="microsoft/git-base")
8
 
9
  def classify(image):
10
- return pipe(image)
 
 
11
 
12
  demo = gr.Interface(fn=classify, inputs=gr.Image(type="filepath"), outputs="text", title="Image Captioning with git-base")
13
 
 
7
  pipe = pipeline("image-to-text", model="microsoft/git-base")
8
 
9
  def classify(image):
10
+ output = pipe(image)
11
+ # example: [{'generated_text': 'front wheels of a truck'}]
12
+ return output[0]['generated_text']
13
 
14
  demo = gr.Interface(fn=classify, inputs=gr.Image(type="filepath"), outputs="text", title="Image Captioning with git-base")
15