Offex commited on
Commit
2f717a0
·
verified ·
1 Parent(s): c75e2b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import torch
3
  import torchaudio
 
4
 
5
  # PyTorch Hub se Silero VAD model load karna
6
  model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad',
@@ -30,7 +31,9 @@ def remove_silence(audio_path):
30
  if not speech_timestamps:
31
  return audio_path
32
 
33
- output_file = 'processed_audio.wav'
 
 
34
  save_audio(output_file, collect_chunks(speech_timestamps, wav), sampling_rate=16000)
35
  return output_file
36
 
@@ -78,4 +81,4 @@ with gr.Blocks(css=css, title="AI Silence Remover") as iface:
78
  submit_btn.click(fn=remove_silence, inputs=audio_in, outputs=audio_out)
79
 
80
  if __name__ == "__main__":
81
- iface.launch()
 
1
  import gradio as gr
2
  import torch
3
  import torchaudio
4
+ import os # <-- फाइल का नाम निकालने के लिए इसे इम्पोर्ट किया है
5
 
6
  # PyTorch Hub se Silero VAD model load karna
7
  model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad',
 
31
  if not speech_timestamps:
32
  return audio_path
33
 
34
+ # 👇 बदलाव यहाँ किया गया है: ओरिजिनल फाइल का नाम इस्तेमाल कर रहे हैं
35
+ output_file = os.path.basename(audio_path)
36
+
37
  save_audio(output_file, collect_chunks(speech_timestamps, wav), sampling_rate=16000)
38
  return output_file
39
 
 
81
  submit_btn.click(fn=remove_silence, inputs=audio_in, outputs=audio_out)
82
 
83
  if __name__ == "__main__":
84
+ iface.launch()