Bouaziz-bad commited on
Commit
63b20f3
·
1 Parent(s): b386b22

Fix Gradio: remove deprecated allow_screenshot

Browse files
Files changed (1) hide show
  1. app.py +18 -11
app.py CHANGED
@@ -2,7 +2,7 @@
2
  import gradio as gr
3
  from backend import KabyleASR
4
 
5
- # Initialize ASR (happens once at startup)
6
  asr = KabyleASR()
7
 
8
  def transcribe_audio(audio):
@@ -10,16 +10,23 @@ def transcribe_audio(audio):
10
  return "Please upload an audio file."
11
  return asr.transcribe(audio)
12
 
13
- # Gradio Interface
14
- demo = gr.Interface(
15
- fn=transcribe_audio,
16
- inputs=gr.Audio(sources=["upload"], type="filepath"),
17
- outputs=gr.Textbox(label="Kabyle Transcription", lines=6),
18
- title="🎙️ Tanti: Kabyle ASR (Free Tier)",
19
- description="Upload a Kabyle audio file. Transcription may take 1–2 minutes per 30 seconds of audio. Powered by NeMo on CPU.",
20
- flagging_mode="never",
21
- allow_screenshot=True
22
- )
 
 
 
 
 
 
 
23
 
24
  # Launch without SSR
25
  if __name__ == "__main__":
 
2
  import gradio as gr
3
  from backend import KabyleASR
4
 
5
+ # Initialize ASR
6
  asr = KabyleASR()
7
 
8
  def transcribe_audio(audio):
 
10
  return "Please upload an audio file."
11
  return asr.transcribe(audio)
12
 
13
+ # Gradio Interface (without deprecated args)
14
+ with gr.Blocks() as demo:
15
+ gr.Markdown("""
16
+ # 🎤 Tanti: Kabyle ASR (Free Tier)
17
+ Upload a Kabyle audio file. Transcription may take 1–2 minutes per 30 seconds of audio.
18
+ """)
19
+
20
+ with gr.Row():
21
+ audio_input = gr.Audio(sources=["upload"], type="filepath", label="Upload Audio")
22
+
23
+ with gr.Row():
24
+ transcribe_btn = gr.Button("Transcribe")
25
+
26
+ with gr.Row():
27
+ output_text = gr.Textbox(label="Transcription", lines=8)
28
+
29
+ transcribe_btn.click(fn=transcribe_audio, inputs=audio_input, outputs=output_text)
30
 
31
  # Launch without SSR
32
  if __name__ == "__main__":