rohitp1 commited on
Commit
2b0ad9d
·
1 Parent(s): dce6276

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -12
app.py CHANGED
@@ -5,18 +5,28 @@
5
 
6
  import gradio as gr
7
  import os
 
 
 
8
 
9
- # save your HF API token from https:/hf.co/settings/tokens as an env variable to avoid rate limiting
10
- auth_token = os.getenv("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")
11
 
12
- # automatically load the interface from a HF model
13
- # you can remove the api_key parameter if you don't care about rate limiting.
14
- demo = gr.load(
15
- "huggingface/rohitp1/kkkh_whisper_small_distillation_att_loss_libri360_epochs_100_batch_4_concat_dataset",
16
- title="Speech-to-text-LibriSpeech-Noise-Robust",
17
- inputs="mic",
18
- description="Let me try to guess what you're saying!",
19
- api_key=auth_token
20
- )
21
 
22
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  import gradio as gr
7
  import os
8
+ import transformers
9
+ from transformers import pipeline
10
+ import time
11
 
12
+ p = pipeline('automatic-speech-recognition', model='rohitp1/kkkh_whisper_small_distillation_att_loss_libri360_epochs_100_batch_4_concat_dataset')
 
13
 
14
+ def transcribe(audio, state=""):
15
+ time.sleep(3)
16
+ text = p(audio)["text"]
17
+ state += text + " "
18
+ return state, state
 
 
 
 
19
 
20
+
21
+
22
+ gr.Interface(
23
+ fn=transcribe,
24
+ inputs=[
25
+ gr.inputs.Audio(source="microphone", type="filepath"),
26
+ 'state'
27
+ ],
28
+ outputs=[
29
+ "textbox",
30
+ "state"
31
+ ],
32
+ live=False).launch()