Spaces:
Sleeping
Sleeping
| #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() | |