Invescoz commited on
Commit
af83e32
·
verified ·
1 Parent(s): 86d5d76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -3,8 +3,9 @@ from faster_whisper import WhisperModel
3
  import tempfile
4
  import os
5
  import numpy as np
 
6
 
7
- # Load model (small = good balance)
8
  model = WhisperModel(
9
  "small",
10
  device="cpu",
@@ -17,9 +18,8 @@ def transcribe(audio):
17
 
18
  sample_rate, data = audio
19
 
20
- # Save temp wav
21
  with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
22
- import wave
23
  with wave.open(f.name, "wb") as wf:
24
  wf.setnchannels(1)
25
  wf.setsampwidth(2)
@@ -58,8 +58,7 @@ def transcribe(audio):
58
  iface = gr.Interface(
59
  fn=transcribe,
60
  inputs=gr.Audio(type="numpy"),
61
- outputs="json",
62
- allow_flagging="never"
63
  )
64
 
65
  iface.launch()
 
3
  import tempfile
4
  import os
5
  import numpy as np
6
+ import wave
7
 
8
+ # Load Whisper model (CPU, free tier safe)
9
  model = WhisperModel(
10
  "small",
11
  device="cpu",
 
18
 
19
  sample_rate, data = audio
20
 
21
+ # Save temp WAV
22
  with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
 
23
  with wave.open(f.name, "wb") as wf:
24
  wf.setnchannels(1)
25
  wf.setsampwidth(2)
 
58
  iface = gr.Interface(
59
  fn=transcribe,
60
  inputs=gr.Audio(type="numpy"),
61
+ outputs="json"
 
62
  )
63
 
64
  iface.launch()