FarhadMadadzade commited on
Commit
534a7d7
1 Parent(s): d14f075
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -5,18 +5,23 @@ import time
5
  pipe = pipeline("automatic-speech-recognition", model="Artanis1551/whisper_romanian3")
6
 
7
 
8
- def transcribe(audio, state=""):
9
- text = pipe(audio)["text"]
 
 
 
 
 
 
10
 
11
- print(text)
12
- state += text + " "
13
- return state, state
14
 
15
-
16
- gr.Interface(
17
- title="Romanian Speech Transcription",
18
  fn=transcribe,
19
  inputs=[gr.Audio(source="microphone", type="filepath", streaming=True), "state"],
20
- outputs=["textbox", "state"],
 
21
  live=True,
22
- ).launch()
 
 
 
 
5
  pipe = pipeline("automatic-speech-recognition", model="Artanis1551/whisper_romanian3")
6
 
7
 
8
+ def transcribe(rec=None, state=""):
9
+ if rec is not None:
10
+ audio = rec
11
+ text = pipe(audio)["text"]
12
+ state += text + ". "
13
+ else:
14
+ text = ""
15
+ return text, state
16
 
 
 
 
17
 
18
+ iface = gr.Interface(
 
 
19
  fn=transcribe,
20
  inputs=[gr.Audio(source="microphone", type="filepath", streaming=True), "state"],
21
+ outputs=["text", "state"],
22
+ title="Romanian Transcription Test",
23
  live=True,
24
+ )
25
+
26
+
27
+ iface.launch()