gjay / app.py
GlenJay2004's picture
Create app.py
dd04c5e verified
raw
history blame contribute delete
582 Bytes
#Filter the warnings
import warnings
warnings.filterwarnings('ignore')
from transformers import logging
logging.set_verbosity_error()
#Import the necessary
import gradio as gr
from transformers import pipeline
#Perform Image Captioning
get_completion = pipeline("image-to-text",model="Salesforce/blip-image-captioning-base")
#Launch the input
def launch(input):
out=get_completion(input)
return out[0]['generated_text']
#Define an interface
interface=gr.Interface(fn=launch,inputs=gr.Image(type="pil"),outputs="text",title="Image Captioning with BLIP")
interface.launch()