jinggujiwoo7
commited on
Commit
β’
fc94876
1
Parent(s):
57a4e23
Update app.py
Browse files
app.py
CHANGED
@@ -23,12 +23,12 @@ def record_student_voice(student_name, question, voice):
|
|
23 |
|
24 |
return "Voice recorded successfully!"
|
25 |
|
26 |
-
# μ μ₯λ μμ±
|
27 |
-
def
|
28 |
if question in recordings:
|
29 |
return recordings[question]
|
30 |
else:
|
31 |
-
return [
|
32 |
|
33 |
# μμ±μ λν μ½λ©νΈ μμ±
|
34 |
def write_comment(question, comment):
|
@@ -54,11 +54,18 @@ record_interface = gr.Interface(
|
|
54 |
title="Record Your Voice"
|
55 |
)
|
56 |
|
57 |
-
|
58 |
-
fn=
|
59 |
inputs=gr.Textbox(placeholder="Question"),
|
60 |
-
outputs=gr.
|
61 |
-
title="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
)
|
63 |
|
64 |
comment_interface = gr.Interface(
|
@@ -69,4 +76,4 @@ comment_interface = gr.Interface(
|
|
69 |
)
|
70 |
|
71 |
# Gradio μ± μ€ν
|
72 |
-
gr.TabbedInterface([question_interface, record_interface, play_interface, comment_interface], ["Teacher's Question", "Record Voice", "
|
|
|
23 |
|
24 |
return "Voice recorded successfully!"
|
25 |
|
26 |
+
# μ μ₯λ μμ± λͺ©λ‘ μ 곡
|
27 |
+
def get_recorded_list(question):
|
28 |
if question in recordings:
|
29 |
return recordings[question]
|
30 |
else:
|
31 |
+
return []
|
32 |
|
33 |
# μμ±μ λν μ½λ©νΈ μμ±
|
34 |
def write_comment(question, comment):
|
|
|
54 |
title="Record Your Voice"
|
55 |
)
|
56 |
|
57 |
+
list_interface = gr.Interface(
|
58 |
+
fn=get_recorded_list,
|
59 |
inputs=gr.Textbox(placeholder="Question"),
|
60 |
+
outputs=gr.Dropdown(label="Select a recording to play"),
|
61 |
+
title="List Recorded Voices"
|
62 |
+
)
|
63 |
+
|
64 |
+
play_interface = gr.Interface(
|
65 |
+
fn=lambda file_path: file_path,
|
66 |
+
inputs=gr.Dropdown(label="Select a recording to play"),
|
67 |
+
outputs=gr.Audio(type="filepath"),
|
68 |
+
title="Play Selected Voice"
|
69 |
)
|
70 |
|
71 |
comment_interface = gr.Interface(
|
|
|
76 |
)
|
77 |
|
78 |
# Gradio μ± μ€ν
|
79 |
+
gr.TabbedInterface([question_interface, record_interface, list_interface, play_interface, comment_interface], ["Teacher's Question", "Record Voice", "List Voices", "Play Voice", "Write Comment"]).launch()
|