Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ def audio_preproccessing():
|
|
| 8 |
os.rename("Audio_DeepFilterNet3.wav", "Audio.wav")
|
| 9 |
print("Audio Preprocessing Done!")
|
| 10 |
|
| 11 |
-
def transcribe_audio(audio_file_path, input_language,denoising):
|
| 12 |
# Auto-detect format from file extension
|
| 13 |
file_ext = os.path.splitext(audio_file_path)[1][1:] # e.g. "mp3", "wav"
|
| 14 |
|
|
@@ -19,6 +19,9 @@ def transcribe_audio(audio_file_path, input_language,denoising):
|
|
| 19 |
audio.export("Audio.wav", format="wav")
|
| 20 |
file_path2 = "Audio.wav"
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
if denoising=='Yes':
|
| 23 |
audio_preproccessing()
|
| 24 |
|
|
@@ -41,11 +44,12 @@ def transcribe_audio(audio_file_path, input_language,denoising):
|
|
| 41 |
iface = gr.Interface(
|
| 42 |
fn=transcribe_audio,
|
| 43 |
inputs=[
|
| 44 |
-
gr.Audio(sources=["
|
| 45 |
#gr.Textbox(label="Language code (e.g., en-US, fa-IR)")
|
| 46 |
gr.Dropdown(choices=["fa-IR", "en-US", "ar-SA"], label="Choose the right language:"),
|
| 47 |
#gr.Checkbox(label="Apply Denoising?")
|
| 48 |
-
gr.Dropdown(choices=["
|
|
|
|
| 49 |
],
|
| 50 |
#outputs="text",
|
| 51 |
outputs=gr.Textbox(label="Transcription results", lines=10),
|
|
|
|
| 8 |
os.rename("Audio_DeepFilterNet3.wav", "Audio.wav")
|
| 9 |
print("Audio Preprocessing Done!")
|
| 10 |
|
| 11 |
+
def transcribe_audio(audio_file_path, input_language,denoising,music):
|
| 12 |
# Auto-detect format from file extension
|
| 13 |
file_ext = os.path.splitext(audio_file_path)[1][1:] # e.g. "mp3", "wav"
|
| 14 |
|
|
|
|
| 19 |
audio.export("Audio.wav", format="wav")
|
| 20 |
file_path2 = "Audio.wav"
|
| 21 |
|
| 22 |
+
#if music=='Yes':
|
| 23 |
+
|
| 24 |
+
|
| 25 |
if denoising=='Yes':
|
| 26 |
audio_preproccessing()
|
| 27 |
|
|
|
|
| 44 |
iface = gr.Interface(
|
| 45 |
fn=transcribe_audio,
|
| 46 |
inputs=[
|
| 47 |
+
gr.Audio(sources=["upload","microphone"], type="filepath", label="Audio Input"),
|
| 48 |
#gr.Textbox(label="Language code (e.g., en-US, fa-IR)")
|
| 49 |
gr.Dropdown(choices=["fa-IR", "en-US", "ar-SA"], label="Choose the right language:"),
|
| 50 |
#gr.Checkbox(label="Apply Denoising?")
|
| 51 |
+
gr.Dropdown(choices=["No","Yes"], label="Need Denoising?"),
|
| 52 |
+
#gr.Dropdown(choices=["No","Yes"], label="Does the input audio have music?")
|
| 53 |
],
|
| 54 |
#outputs="text",
|
| 55 |
outputs=gr.Textbox(label="Transcription results", lines=10),
|