ImageCaptioning / app.py
ronniet's picture
Update app.py
1be9167
raw
history blame
No virus
507 Bytes
import gradio as gr
from transformers import pipeline
captioner = pipeline(model="microsoft/git-base")
tts = pipeline(model="suno/bark-small")
def predict(image):
text = captioner(image)[0]["generated_text"]
audio = tts(text)["audio"]
return text, audio
demo = gr.Interface(
fn=predict,
inputs=gr.Image(type="pil"),
outputs=['text', gr.Audio()]
)
demo.launch()
# gr.Interface.load("models/ronniet/git-base-env").launch()
# gr.Interface.load("models/microsoft/git-base").launch()