Spaces:
Build error
Build error
Commit
·
ea0a44f
1
Parent(s):
369f023
Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ def inference(raw_image, model_n, question, strategy):
|
|
52 |
if strategy == "Beam search":
|
53 |
caption = model.generate(image, sample=False, num_beams=3, max_length=20, min_length=5)
|
54 |
else:
|
55 |
-
caption = model.generate(image, sample=True, top_p=0.
|
56 |
return 'caption: '+caption[0]
|
57 |
|
58 |
else:
|
@@ -61,7 +61,7 @@ def inference(raw_image, model_n, question, strategy):
|
|
61 |
answer = model_vq(image_vq, question, train=False, inference='generate')
|
62 |
return 'answer: '+answer[0]
|
63 |
|
64 |
-
inputs = [gr.inputs.Image(type='pil'),gr.inputs.Radio(choices=['Image Captioning',"Visual Question Answering"], type="value", default="Image Captioning", label="
|
65 |
outputs = gr.outputs.Textbox(label="Output")
|
66 |
|
67 |
title = "BLIP"
|
|
|
52 |
if strategy == "Beam search":
|
53 |
caption = model.generate(image, sample=False, num_beams=3, max_length=20, min_length=5)
|
54 |
else:
|
55 |
+
caption = model.generate(image, sample=True, top_p=0.95, max_length=20, min_length=5)
|
56 |
return 'caption: '+caption[0]
|
57 |
|
58 |
else:
|
|
|
61 |
answer = model_vq(image_vq, question, train=False, inference='generate')
|
62 |
return 'answer: '+answer[0]
|
63 |
|
64 |
+
inputs = [gr.inputs.Image(type='pil'),gr.inputs.Radio(choices=['Image Captioning',"Visual Question Answering"], type="value", default="Image Captioning", label="Task"),"textbox",gr.inputs.Radio(choices=['Beam search','Nucleus sampling'], type="value", default="Nucleus sampling", label="Caption Decoding Strategy")]
|
65 |
outputs = gr.outputs.Textbox(label="Output")
|
66 |
|
67 |
title = "BLIP"
|