HopeLiang commited on
Commit
c98376b
·
1 Parent(s): 76636ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -6,15 +6,18 @@ pipe2 = pipeline('text-generation', model='birgermoell/swedish-gpt')
6
 
7
  def transcribe(audio):
8
  text = pipe1(audio)["text"]
9
- generated_text = pipe2(text, max_length = 30, num_return_sequences=2)[0]['generated_text']
10
  return text, generated_text
11
 
12
  iface = gr.Interface(
13
  fn=transcribe,
14
  inputs=gr.Audio(source="microphone", type="filepath"),
15
- outputs=['text', 'text'],
 
 
 
16
  title="Whisper Small Swedish + Swedish GPT",
17
- description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model and text generation with Swedish GPT.",
18
  )
19
 
20
  iface.launch()
 
6
 
7
  def transcribe(audio):
8
  text = pipe1(audio)["text"]
9
+ generated_text = pipe2(text, max_length=50, num_return_sequences=2)[0]['generated_text']
10
  return text, generated_text
11
 
12
  iface = gr.Interface(
13
  fn=transcribe,
14
  inputs=gr.Audio(source="microphone", type="filepath"),
15
+ outputs=[
16
+ gr.Textbox(label='Transcribed Speech'),
17
+ gr.Textbox(label='Swedish GPT Generated Speech')
18
+ ],
19
  title="Whisper Small Swedish + Swedish GPT",
20
+ description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model & text generation with Swedish GPT.",
21
  )
22
 
23
  iface.launch()