Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import torch
|
|
4 |
|
5 |
torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cats.jpg')
|
6 |
torch.hub.download_url_to_file('https://huggingface.co/datasets/nielsr/textcaps-sample/resolve/main/stop_sign.png', 'stop_sign.png')
|
|
|
7 |
|
8 |
git_processor_base = AutoProcessor.from_pretrained("microsoft/git-base-coco")
|
9 |
git_model_base = AutoModelForCausalLM.from_pretrained("microsoft/git-base-coco")
|
@@ -56,7 +57,7 @@ def generate_captions(image):
|
|
56 |
return caption_git_base, caption_git_large, caption_blip_base, caption_blip_large, caption_vitgpt
|
57 |
|
58 |
|
59 |
-
examples = [["cats.jpg"], ["stop_sign.png"]]
|
60 |
outputs = [gr.outputs.Textbox(label="Caption generated by GIT-base"), gr.outputs.Textbox(label="Caption generated by GIT-large"), gr.outputs.Textbox(label="Caption generated by BLIP-base"), gr.outputs.Textbox(label="Caption generated by BLIP-large"), gr.outputs.Textbox(label="Caption generated by ViT+GPT-2")]
|
61 |
|
62 |
title = "Interactive demo: comparing image captioning models"
|
|
|
4 |
|
5 |
torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cats.jpg')
|
6 |
torch.hub.download_url_to_file('https://huggingface.co/datasets/nielsr/textcaps-sample/resolve/main/stop_sign.png', 'stop_sign.png')
|
7 |
+
torch.hub.download_url_to_file('https://cdn.openai.com/dall-e-2/demos/text2im/astronaut/horse/photo/0.jpg', 'astronaut.jpg')
|
8 |
|
9 |
git_processor_base = AutoProcessor.from_pretrained("microsoft/git-base-coco")
|
10 |
git_model_base = AutoModelForCausalLM.from_pretrained("microsoft/git-base-coco")
|
|
|
57 |
return caption_git_base, caption_git_large, caption_blip_base, caption_blip_large, caption_vitgpt
|
58 |
|
59 |
|
60 |
+
examples = [["cats.jpg"], ["stop_sign.png"], ["astronaut.jpg"]]
|
61 |
outputs = [gr.outputs.Textbox(label="Caption generated by GIT-base"), gr.outputs.Textbox(label="Caption generated by GIT-large"), gr.outputs.Textbox(label="Caption generated by BLIP-base"), gr.outputs.Textbox(label="Caption generated by BLIP-large"), gr.outputs.Textbox(label="Caption generated by ViT+GPT-2")]
|
62 |
|
63 |
title = "Interactive demo: comparing image captioning models"
|