Spaces:
Sleeping
Sleeping
Pick out the text.
Browse files
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 |
-
|
|
|
|
|
|
|
| 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 |
|