Eric Guan commited on
Commit
0340380
·
1 Parent(s): 2c18b36

Updated app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -28
app.py CHANGED
@@ -1,33 +1,11 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- model = "openai/whisper-small"
5
- pipe = pipeline("automatic-speech-recognition", model=model)
6
 
7
- def transcribe_speech(filepath):
8
- output = pipe(
9
- filepath,
10
- max_new_tokens=256,
11
- generate_kwargs={
12
- "task": "transcribe",
13
- },
14
- chunk_length_s=30,
15
- batch_size=8,
16
- )
17
- return output["text"]
18
 
19
- demo = gr.Blocks()
20
-
21
- mic_transcribe = gr.Interface(
22
- fn=transcribe_speech,
23
- inputs=gr.Audio(sources="microphone", type="filepath"),
24
- outputs=gr.outputs.Textbox(),
25
- )
26
-
27
- with demo:
28
- gr.TabbedInterface(
29
- [mic_transcribe],
30
- ["Transcribe Microphone"],
31
- )
32
-
33
- demo.launch(debug=True)
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # model = "openai/whisper-small"
5
+ # pipe = pipeline("automatic-speech-recognition", model=model)
6
 
7
+ def greet(name):
8
+ return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
9
 
10
+ demo = gr.Interface(fn=greet, inputs="text", outputs="text")
11
+ demo.launch()