Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,14 +2,17 @@ import gradio as gr
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
captioner = pipeline(model="microsoft/git-base")
|
|
|
|
| 5 |
|
| 6 |
def predict(image):
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
demo = gr.Interface(
|
| 10 |
fn=predict,
|
| 11 |
inputs=gr.Image(type="pil"),
|
| 12 |
-
outputs='text'
|
| 13 |
)
|
| 14 |
|
| 15 |
demo.launch()
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
captioner = pipeline(model="microsoft/git-base")
|
| 5 |
+
tts = pipeline(model="suno/bark-small")
|
| 6 |
|
| 7 |
def predict(image):
|
| 8 |
+
text = captioner(image)[0]["generated_text"]
|
| 9 |
+
audio = tts(text)["audio"]
|
| 10 |
+
return text, audio
|
| 11 |
|
| 12 |
demo = gr.Interface(
|
| 13 |
fn=predict,
|
| 14 |
inputs=gr.Image(type="pil"),
|
| 15 |
+
outputs=['text', gr.Audio()]
|
| 16 |
)
|
| 17 |
|
| 18 |
demo.launch()
|