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
|
4 |
-
|
5 |
|
6 |
model_id = "dblasko/blip-dalle3-img2prompt"
|
7 |
model = BlipForConditionalGeneration.from_pretrained(model_id)
|
@@ -21,9 +21,10 @@ def generate_caption(image):
|
|
21 |
|
22 |
return generated_caption, audio_path
|
23 |
|
|
|
24 |
def play_audio(audio_path):
|
25 |
-
|
26 |
-
|
27 |
|
28 |
# Create a Gradio interface with an image input, a textbox output, a button, and an audio player
|
29 |
demo = gr.Interface(
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
3 |
+
from pydub import AudioSegment
|
4 |
+
from pydub.playback import play
|
5 |
|
6 |
model_id = "dblasko/blip-dalle3-img2prompt"
|
7 |
model = BlipForConditionalGeneration.from_pretrained(model_id)
|
|
|
21 |
|
22 |
return generated_caption, audio_path
|
23 |
|
24 |
+
|
25 |
def play_audio(audio_path):
|
26 |
+
sound = AudioSegment.from_file(audio_path)
|
27 |
+
play(sound)
|
28 |
|
29 |
# Create a Gradio interface with an image input, a textbox output, a button, and an audio player
|
30 |
demo = gr.Interface(
|