RanjithkumarPanjabikesan commited on
Commit
5111187
·
verified ·
1 Parent(s): 1c6ab51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -1,13 +1,21 @@
 
1
  import gradio as gr
2
  from transformers import pipeline
3
  pipe = pipeline("image-to-text",
4
  model="Salesforce/blip-image-captioning-base")
 
 
5
  def launch(input):
6
  out = pipe(input)
7
  return out[0]['generated_text']
8
- iface = gr.Interface(launch,
 
9
  inputs=gr.Image(type='pil'),
10
- outputs="text")
11
- iface.launch()
 
 
 
 
 
12
 
13
-
 
1
+ #Build Image Captioner App and Launch
2
  import gradio as gr
3
  from transformers import pipeline
4
  pipe = pipeline("image-to-text",
5
  model="Salesforce/blip-image-captioning-base")
6
+
7
+
8
  def launch(input):
9
  out = pipe(input)
10
  return out[0]['generated_text']
11
+
12
+ image_captioner_app = gr.Interface(launch,
13
  inputs=gr.Image(type='pil'),
14
+ outputs="Caption of the Image")
15
+
16
+ with gr.Blocks() as demo:
17
+ gr.TabbedInterface(
18
+ [image_captioner_app],
19
+ ["Image Captioner"])
20
+ demo.launch()
21