Spaces:
Build error
Build error
JunnanLi
commited on
Commit
•
369f023
1
Parent(s):
ea784ed
Update app.py
Browse files
app.py
CHANGED
@@ -49,7 +49,7 @@ def inference(raw_image, model_n, question, strategy):
|
|
49 |
if model_n == 'Image Captioning':
|
50 |
image = transform(raw_image).unsqueeze(0).to(device)
|
51 |
with torch.no_grad():
|
52 |
-
if strategy == "
|
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.9, max_length=20, min_length=5)
|
|
|
49 |
if model_n == 'Image Captioning':
|
50 |
image = transform(raw_image).unsqueeze(0).to(device)
|
51 |
with torch.no_grad():
|
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.9, max_length=20, min_length=5)
|