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