File size: 797 Bytes
1a7973f
5eb99ac
ec574b7
5eb99ac
 
 
 
460a57d
 
fac92f6
460a57d
 
 
 
d6da658
be8da16
 
 
4902385
460a57d
4902385
1a7973f
415ea49
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from transformers import pipeline,WhisperProcessor, WhisperForConditionalGeneration
import torch
import librosa

checkpoint = "openai/whisper-base"
# checkpoint = "/innev/open-ai/huggingface/openai/whisper-base"
image_to_text_model = pipeline("image-classification")
text_to_audio_model = pipeline("text-to-speech")

def image_to_text(input_image):
    # Convertir la imagen a texto
    text_output = image_to_text_model(input_image)[0]['label']
    return text_output

with gr.Blocks() as demo:
    gr.Markdown("Start typing below and then click **Run** to see the output.")
    with gr.Row():
        inp = gr.Image()
        out = gr.Textbox(placeholder=image_to_text(inp))
    gr.Interface(fn=image_to_text, inputs=inp, outputs=out,interpretation="default")

demo.launch()