Josephanthraper commited on
Commit
458580e
·
verified ·
1 Parent(s): 13f81a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py CHANGED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import gradio as gr
3
+ from whisper_jax import FlaxWhisperPipline
4
+ import jax.numpy as jnp
5
+
6
+ # Load Whisper JAX model once (on startup)
7
+ pipeline = FlaxWhisperPipline(
8
+ "parthiv11/indic_whisper_nodcil",
9
+ dtype=jnp.bfloat16
10
+ )
11
+
12
+ # Function connected to Gradio
13
+ def transcribe(audio_file):
14
+ if audio_file is None:
15
+ return "Please upload an audio file."
16
+
17
+ result = pipeline(audio_file)
18
+ return result["text"] if isinstance(result, dict) else result
19
+
20
+ # Build UI (this part comes from Playground export)
21
+ demo = gr.Interface(
22
+ fn=transcribe,
23
+ inputs=gr.Audio(type="filepath"),
24
+ outputs="text",
25
+ title="Hindi Whisper JAX Transcription",
26
+ description="Upload or record Hindi speech and get transcription using Whisper JAX."
27
+ )
28
+
29
+ if __name__ == "__main__":
30
+ demo.launch(server_name="0.0.0.0", server_port=7860, show_error=True)