Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
3 |
from gtts import gTTS
|
4 |
-
|
5 |
|
6 |
model_id = "dblasko/blip-dalle3-img2prompt"
|
7 |
model = BlipForConditionalGeneration.from_pretrained(model_id)
|
@@ -22,7 +22,10 @@ def generate_caption(image):
|
|
22 |
return generated_caption, audio_path
|
23 |
|
24 |
def play_audio(audio_path):
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
# Create a Gradio interface with an image input, a textbox output, a button, and an audio player
|
28 |
demo = gr.Interface(
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
3 |
from gtts import gTTS
|
4 |
+
import pygame
|
5 |
|
6 |
model_id = "dblasko/blip-dalle3-img2prompt"
|
7 |
model = BlipForConditionalGeneration.from_pretrained(model_id)
|
|
|
22 |
return generated_caption, audio_path
|
23 |
|
24 |
def play_audio(audio_path):
|
25 |
+
pygame.mixer.init()
|
26 |
+
pygame.mixer.music.load(audio_path)
|
27 |
+
pygame.mixer.music.play()
|
28 |
+
pygame.event.wait()
|
29 |
|
30 |
# Create a Gradio interface with an image input, a textbox output, a button, and an audio player
|
31 |
demo = gr.Interface(
|