File size: 471 Bytes
28fa8d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline

model_pipeline = pipeline("image-to-text",
                          model = "Salesforce/blip-image-captioning-base")
#990M model

def main(input):
  output = model_pipeline(input)  #globally defined model pipeline
  return output[0]['generated_text'] #generated output captoion string

interface_gradio = gr.Interface(
    main,
    inputs = gr.Image(type = 'pil'),
    outputs = "text"
)

interface_gradio.launch()