Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,12 @@ def text_to_audio_file(text):
|
|
| 38 |
|
| 39 |
return tmp_path
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
# -------------------------------
|
| 43 |
# Gradio interface: Caption + Audio
|
| 44 |
# -------------------------------
|
|
|
|
| 38 |
|
| 39 |
return tmp_path
|
| 40 |
|
| 41 |
+
def generate_caption_from_image(model, processor, image):
|
| 42 |
+
# image: PIL.Image
|
| 43 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 44 |
+
out = model.generate(**inputs)
|
| 45 |
+
caption = processor.decode(out[0], skip_special_tokens=True)
|
| 46 |
+
return caption
|
| 47 |
# -------------------------------
|
| 48 |
# Gradio interface: Caption + Audio
|
| 49 |
# -------------------------------
|