Update app.py
Browse files
app.py
CHANGED
@@ -47,6 +47,13 @@ def get_feedback(similarity):
|
|
47 |
|
48 |
# Function to process audio and match it with the closest Qur'an verse
|
49 |
def process_audio(audio):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
transcription = recognizer(audio)["text"]
|
51 |
|
52 |
# Find the most similar verse
|
@@ -80,7 +87,7 @@ def process_audio(audio):
|
|
80 |
# Interface
|
81 |
iface = gr.Interface(
|
82 |
fn=process_audio,
|
83 |
-
inputs=gr.Audio(type="filepath"), #
|
84 |
outputs=gr.Textbox(), # Only use a Textbox to display progress and feedback
|
85 |
title="Qur'an Memorization Helper",
|
86 |
description="Speak a verse, and we'll transcribe it, check your accuracy, and track your progress."
|
|
|
47 |
|
48 |
# Function to process audio and match it with the closest Qur'an verse
|
49 |
def process_audio(audio):
|
50 |
+
print(f"Audio Input: {audio}")
|
51 |
+
|
52 |
+
# Check if audio is None
|
53 |
+
if audio is None:
|
54 |
+
return "No audio file provided. Please upload or record an audio."
|
55 |
+
|
56 |
+
# Transcribe the audio
|
57 |
transcription = recognizer(audio)["text"]
|
58 |
|
59 |
# Find the most similar verse
|
|
|
87 |
# Interface
|
88 |
iface = gr.Interface(
|
89 |
fn=process_audio,
|
90 |
+
inputs=gr.Audio(type="filepath"), # You can change this to "numpy" if needed
|
91 |
outputs=gr.Textbox(), # Only use a Textbox to display progress and feedback
|
92 |
title="Qur'an Memorization Helper",
|
93 |
description="Speak a verse, and we'll transcribe it, check your accuracy, and track your progress."
|