Spaces:
Runtime error
Runtime error
ydshieh
commited on
Commit
•
9eed0db
1
Parent(s):
f4148f7
fix syntax
Browse files
model.py
CHANGED
@@ -53,7 +53,10 @@ def predict(image):
|
|
53 |
token_ids = np.array(generation.sequences)[0]
|
54 |
caption = tokenizer.decode(token_ids)
|
55 |
caption = caption.replace('<s>', '').replace('</s>', '').replace('<pad>', '')
|
56 |
-
caption.replace("à l'arrière-plan", '').("Une photo noire et blanche d'", '').replace("en arrière-plan", '')
|
|
|
|
|
|
|
57 |
|
58 |
return caption
|
59 |
|
|
|
53 |
token_ids = np.array(generation.sequences)[0]
|
54 |
caption = tokenizer.decode(token_ids)
|
55 |
caption = caption.replace('<s>', '').replace('</s>', '').replace('<pad>', '')
|
56 |
+
caption.replace("à l'arrière-plan", '').replace("Une photo noire et blanche d'", '').replace("en arrière-plan", '')
|
57 |
+
while ' ' in caption:
|
58 |
+
caption = caption.replace(' ', ' ')
|
59 |
+
caption = caption.strip()
|
60 |
|
61 |
return caption
|
62 |
|