brezende commited on
Commit
deb6381
1 Parent(s): a4471a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -5,7 +5,7 @@ import pytube as pt
5
  from transformers import pipeline
6
  from huggingface_hub import model_info
7
 
8
- MODEL_NAME = "openai/whisper-medium"
9
 
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
11
 
@@ -18,18 +18,18 @@ pipe = pipeline(
18
 
19
  langs = model_info(MODEL_NAME).cardData["language"]
20
 
21
- article = f"<details><summary>This model supports {len(langs)} languages! (Click to expand)</summary>> {langs}</details>"
22
 
23
  def transcribe(microphone, file_upload):
24
  warn_output = ""
25
  if (microphone is not None) and (file_upload is not None):
26
  warn_output = (
27
- "WARNING: You've uploaded an audio file and used the microphone. "
28
  "The recorded file from the microphone will be used and the uploaded audio will be discarded.\n"
29
  )
30
 
31
  elif (microphone is None) and (file_upload is None):
32
- return "ERROR: You have to either use the microphone or upload an audio file"
33
 
34
  file = microphone if microphone is not None else file_upload
35
 
@@ -69,9 +69,9 @@ mf_transcribe = gr.Interface(
69
  outputs="text",
70
  layout="horizontal",
71
  theme="huggingface",
72
- title="Whisper Demo: Transcribe Audio",
73
  description=(
74
- "Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the the fine-tuned"
75
  f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
76
  " of arbitrary length."
77
  ),
@@ -85,9 +85,9 @@ yt_transcribe = gr.Interface(
85
  outputs=["html", "text"],
86
  layout="horizontal",
87
  theme="huggingface",
88
- title="Whisper Demo: Transcribe YouTube",
89
  description=(
90
- "Transcribe long-form YouTube videos with the click of a button! Demo uses the the fine-tuned checkpoint:"
91
  f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of"
92
  " arbitrary length."
93
  ),
 
5
  from transformers import pipeline
6
  from huggingface_hub import model_info
7
 
8
+ MODEL_NAME = "cloudqi/cqi_speech_recognize_pt_v0"
9
 
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
11
 
 
18
 
19
  langs = model_info(MODEL_NAME).cardData["language"]
20
 
21
+ article = f"<details><summary>Esse modelo suporta as linguas {len(langs)} ! (Clique para expandir)</summary>> {langs}</details>"
22
 
23
  def transcribe(microphone, file_upload):
24
  warn_output = ""
25
  if (microphone is not None) and (file_upload is not None):
26
  warn_output = (
27
+ "WARNING: Você carregou um arquivo de áudio e usou o microfone. "
28
  "The recorded file from the microphone will be used and the uploaded audio will be discarded.\n"
29
  )
30
 
31
  elif (microphone is None) and (file_upload is None):
32
+ return "ERROR: Transcreva microfones longos ou entradas de áudio com o clique de um botão"
33
 
34
  file = microphone if microphone is not None else file_upload
35
 
 
69
  outputs="text",
70
  layout="horizontal",
71
  theme="huggingface",
72
+ title="Demonstração: Transcrever Audio",
73
  description=(
74
+ "Transcreva microfones longos ou entradas de áudio com o clique de um botão! Demo uses the the fine-tuned"
75
  f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
76
  " of arbitrary length."
77
  ),
 
85
  outputs=["html", "text"],
86
  layout="horizontal",
87
  theme="huggingface",
88
+ title="Demonstração: Transcrever do YouTube",
89
  description=(
90
+ "Gere legendas com um clique ! Demo uses the the fine-tuned checkpoint:"
91
  f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of"
92
  " arbitrary length."
93
  ),