Spaces:
Sleeping
Sleeping
TheKnight115
commited on
Commit
•
09489a7
1
Parent(s):
daaf0d5
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
pipe = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
|
5 |
+
|
6 |
+
def genetreted_caption(images):
|
7 |
+
result= pipe(images)
|
8 |
+
return result[0]['generated_text']
|
9 |
+
|
10 |
+
|
11 |
+
interface= gr.Interface(genetreted_caption,inputs =gr.Image(type="pil"),outputs="text")
|
12 |
+
interface.launch(share=True)
|