Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,15 +2,6 @@ import gradio as gr
|
|
2 |
from transformers import AutoProcessor, AutoTokenizer, AutoImageProcessor, AutoModelForCausalLM, BlipForConditionalGeneration, VisionEncoderDecoderModel
|
3 |
import torch
|
4 |
|
5 |
-
torch.hub.download_url_to_file('test-1.jpg', 'test-1.jpg')
|
6 |
-
torch.hub.download_url_to_file('test-2.jpg', 'test-2.jpg')
|
7 |
-
torch.hub.download_url_to_file('test-3.jpg', 'test-3.jpg')
|
8 |
-
torch.hub.download_url_to_file('test-4.jpg', 'test-4.jpg')
|
9 |
-
torch.hub.download_url_to_file('test-5.jpg', 'test-5.jpg')
|
10 |
-
torch.hub.download_url_to_file('test-6.jpg', 'test-6.jpg')
|
11 |
-
torch.hub.download_url_to_file('test-7.jpg', 'test-7.jpg')
|
12 |
-
|
13 |
-
|
14 |
git_processor_base = AutoProcessor.from_pretrained("microsoft/git-base-coco")
|
15 |
git_model_base = AutoModelForCausalLM.from_pretrained("microsoft/git-base-coco")
|
16 |
|
@@ -62,7 +53,7 @@ def generate_captions(image):
|
|
62 |
return caption_git_base, caption_git_large, caption_blip_base, caption_blip_large, caption_vitgpt
|
63 |
|
64 |
|
65 |
-
examples = [["test-1.jpg"], ["test-2.
|
66 |
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")]
|
67 |
|
68 |
title = "Interactive demo: comparing image captioning models"
|
|
|
2 |
from transformers import AutoProcessor, AutoTokenizer, AutoImageProcessor, AutoModelForCausalLM, BlipForConditionalGeneration, VisionEncoderDecoderModel
|
3 |
import torch
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
git_processor_base = AutoProcessor.from_pretrained("microsoft/git-base-coco")
|
6 |
git_model_base = AutoModelForCausalLM.from_pretrained("microsoft/git-base-coco")
|
7 |
|
|
|
53 |
return caption_git_base, caption_git_large, caption_blip_base, caption_blip_large, caption_vitgpt
|
54 |
|
55 |
|
56 |
+
examples = [["test-1.jpg"], ["test-2.jpg"], ["test-3.jpg"]]
|
57 |
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")]
|
58 |
|
59 |
title = "Interactive demo: comparing image captioning models"
|