iffazainab commited on
Commit
cf3a98a
·
verified ·
1 Parent(s): 0715516

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -7,17 +7,14 @@ stt_pipeline = pipeline(
7
  model="openai/whisper-small"
8
  )
9
 
10
- # Function: transcribe + show detected language
11
  def transcribe(audio):
12
  if audio is None:
13
  return "Please record some audio."
14
 
15
  result = stt_pipeline(audio)
16
  text = result["text"]
17
- # Hugging Face Whisper pipeline includes detected language
18
- # lang = result.get("language", "unknown").capitalize()
19
-
20
- # return f"Detected language: {lang}\n\n{text}"
21
 
22
  with gr.Blocks() as demo:
23
  gr.Markdown("# 🎙️ Speech to Text Converter")
@@ -35,3 +32,4 @@ with gr.Blocks() as demo:
35
  demo.launch()
36
 
37
 
 
 
7
  model="openai/whisper-small"
8
  )
9
 
10
+ # Function: transcribe (auto-detects language internally)
11
  def transcribe(audio):
12
  if audio is None:
13
  return "Please record some audio."
14
 
15
  result = stt_pipeline(audio)
16
  text = result["text"]
17
+ return text
 
 
 
18
 
19
  with gr.Blocks() as demo:
20
  gr.Markdown("# 🎙️ Speech to Text Converter")
 
32
  demo.launch()
33
 
34
 
35
+