Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,20 +27,13 @@ pixel_values = feature_extractor(images=image, return_tensors="pt").pixel_values
|
|
27 |
# use GPT2's eos_token as the pad as well as eos token
|
28 |
|
29 |
|
30 |
-
# generation
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
print(captions)
|
36 |
-
|
37 |
|
38 |
def predict(image,max_length=24, num_beams=4):
|
39 |
image = image.convert('RGB')
|
40 |
sequences = model.generate(pixel_values, num_beams=4, max_length=25)
|
41 |
sequences = model.generate(pixel_values, num_beams=4, max_length=25)
|
42 |
captions = tokenizer.batch_decode(sequences, skip_special_tokens=True)
|
43 |
-
return
|
44 |
|
45 |
|
46 |
# Gradio Interface
|
|
|
27 |
# use GPT2's eos_token as the pad as well as eos token
|
28 |
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
def predict(image,max_length=24, num_beams=4):
|
32 |
image = image.convert('RGB')
|
33 |
sequences = model.generate(pixel_values, num_beams=4, max_length=25)
|
34 |
sequences = model.generate(pixel_values, num_beams=4, max_length=25)
|
35 |
captions = tokenizer.batch_decode(sequences, skip_special_tokens=True)
|
36 |
+
return captions
|
37 |
|
38 |
|
39 |
# Gradio Interface
|