Spaces:
Runtime error
Runtime error
Download app.py from AbhijithJ002/BLIP-Multimodal: direct link, hf CLI and curl.
- Browser
- Download file 592 Bytes
-
https://huggingface.co/spaces/AbhijithJ002/BLIP-Multimodal/resolve/main/app.py
- Command line
-
hf download hf://spaces/AbhijithJ002/BLIP-Multimodal/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AbhijithJ002/BLIP-Multimodal/resolve/main/app.py
592 Bytes
| from transformers import BlipForQuestionAnswering | |
| from transformers import AutoProcessor | |
| import gradio as gr | |
| model = BlipForQuestionAnswering.from_pretrained("Salesforce/blip-vqa-base") | |
| processor = AutoProcessor.from_pretrained("Salesforce/blip-vqa-base") | |
| def launch(image,question): | |
| inputs = processor(image, question, return_tensors="pt") | |
| out = model.generate(**inputs) | |
| return processor.decode(out[0], skip_special_tokens=True) | |
| iface = gr.Interface(launch, | |
| inputs=[gr.Image(type='pil'),gr.Textbox()], | |
| outputs="text") | |
| iface.launch() |