iapain commited on
Commit
5650a80
·
1 Parent(s): 464feb4

feat: adds english caption using blip model

Browse files
Files changed (2) hide show
  1. app.py +13 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ model_id = "Salesforce/blip-image-captioning-large"
5
+ caption_eng = pipeline(model=model_id)
6
+
7
+ def evaluate():
8
+ return caption_eng(input)[0]["generated_text"]
9
+
10
+ iface = gr.Interface(fn=evaluate, inputs=gr.Image(type="pil"), outputs="text")
11
+
12
+ if __name__ == "__main__":
13
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ transformers
3
+ torch