Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,9 +34,11 @@ excel_file_path = "ASR_live_test.xlsx"
|
|
34 |
sheet_name= 'sample_test'
|
35 |
choices = read_excel_data(excel_file_path, sheet_name)
|
36 |
|
|
|
37 |
def similar(a, b):
|
38 |
return SequenceMatcher(None, a, b).ratio()
|
39 |
|
|
|
40 |
def transcribe(audio, reference_text):
|
41 |
time.sleep(1)
|
42 |
text = p(audio)["text"]
|
@@ -53,6 +55,11 @@ def transcribe(audio, reference_text):
|
|
53 |
else :
|
54 |
print(" Null Object")
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
# Gradio apps
|
57 |
# get the list of the correct text to read
|
58 |
dropdown_choices = choices.keys()
|
@@ -124,5 +131,10 @@ with demo :
|
|
124 |
# Clear the recording
|
125 |
clear_btn.click(lambda: None, None, audio_record, queue=False)
|
126 |
|
|
|
|
|
|
|
|
|
|
|
127 |
if __name__ == "__main__":
|
128 |
-
demo.launch()
|
|
|
34 |
sheet_name= 'sample_test'
|
35 |
choices = read_excel_data(excel_file_path, sheet_name)
|
36 |
|
37 |
+
# Similarity function
|
38 |
def similar(a, b):
|
39 |
return SequenceMatcher(None, a, b).ratio()
|
40 |
|
41 |
+
# Audio Transcription function
|
42 |
def transcribe(audio, reference_text):
|
43 |
time.sleep(1)
|
44 |
text = p(audio)["text"]
|
|
|
55 |
else :
|
56 |
print(" Null Object")
|
57 |
|
58 |
+
# Authentication function
|
59 |
+
def update_message(request: gr.Request):
|
60 |
+
return f"Welcome, {request.username}"
|
61 |
+
|
62 |
+
|
63 |
# Gradio apps
|
64 |
# get the list of the correct text to read
|
65 |
dropdown_choices = choices.keys()
|
|
|
131 |
# Clear the recording
|
132 |
clear_btn.click(lambda: None, None, audio_record, queue=False)
|
133 |
|
134 |
+
# User authentication
|
135 |
+
m = gr.Markdown()
|
136 |
+
logout_button = gr.Button("Logout", link="/logout")
|
137 |
+
demo.load(update_message, None, m)
|
138 |
+
|
139 |
if __name__ == "__main__":
|
140 |
+
demo.launch(auth=[("randa", "randa"), ("karim", "karim")], share=True)
|