Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Interface Gradio
|
8 |
interface = gr.Interface(
|
9 |
-
fn=
|
10 |
-
inputs=gr.
|
11 |
-
outputs="text", # Saída
|
12 |
-
title="
|
13 |
-
description="
|
|
|
14 |
)
|
15 |
|
16 |
-
#
|
17 |
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import whisper
|
3 |
|
4 |
+
# Carregar o modelo Whisper
|
5 |
+
model = whisper.load_model("base")
|
6 |
+
|
7 |
+
# Função para transcrição
|
8 |
+
def transcribe(audio):
|
9 |
+
result = model.transcribe(audio.name) # Certifique-se de usar o caminho correto do arquivo
|
10 |
+
return result["text"]
|
11 |
|
12 |
# Interface Gradio
|
13 |
interface = gr.Interface(
|
14 |
+
fn=transcribe,
|
15 |
+
inputs=gr.Audio(type="filepath", label="Carregue seu arquivo de áudio"), # Campo para o arquivo de áudio
|
16 |
+
outputs="text", # Saída do texto transcrito
|
17 |
+
title="Transcrição de Áudio com Whisper", # Título da interface
|
18 |
+
description="Carregue um arquivo de áudio para obter a transcrição.", # Descrição
|
19 |
+
allow_flagging="never" # Desabilitar flagging
|
20 |
)
|
21 |
|
22 |
+
# Executar o app
|
23 |
interface.launch()
|