Update spoken_module.py
Browse files- spoken_module.py +25 -30
spoken_module.py
CHANGED
|
@@ -84,12 +84,6 @@ def spoken_dashboard(nickname_input):
|
|
| 84 |
goal_dropdown = gr.Dropdown(label="π― Goal", choices=["Interview preparation", "Public speaking", "Class presentation", "General improvement"], value="General improvement")
|
| 85 |
focus_checkboxes = gr.CheckboxGroup(label="π§ Focus Areas", choices=["Clarity", "Structure", "Fluency", "Tone", "Content Relevance"], value=["Clarity", "Structure", "Fluency", "Tone", "Content Relevance"])
|
| 86 |
|
| 87 |
-
trend_category_dropdown = gr.Dropdown(
|
| 88 |
-
label="π Track Progress In",
|
| 89 |
-
choices=["Clarity", "Structure", "Fluency", "Tone", "Content Relevance"],
|
| 90 |
-
value="Tone"
|
| 91 |
-
)
|
| 92 |
-
|
| 93 |
with gr.Row():
|
| 94 |
audio_input = gr.Audio(type="filepath", label="π Speak or Upload Audio")
|
| 95 |
audio_output = gr.Audio(label="π Chatter's Response", type="filepath")
|
|
@@ -106,30 +100,16 @@ def spoken_dashboard(nickname_input):
|
|
| 106 |
history_table = gr.Dataframe(headers=["π Timestamp", "π Language", "π Transcript", "π¬ Feedback"])
|
| 107 |
|
| 108 |
with gr.Row():
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
def update_trend_chart(trend_category, nickname):
|
| 120 |
-
if hasattr(nickname, "value"):
|
| 121 |
-
nickname = nickname.value
|
| 122 |
-
sessions = fetch_user_sessions(nickname)
|
| 123 |
-
dates, trend_scores = build_trend_data(sessions, trend_category)
|
| 124 |
-
if trend_scores:
|
| 125 |
-
return render_trend_chart(dates, trend_scores, trend_category)
|
| 126 |
-
return render_empty_chart(f"π {trend_category} Progress")
|
| 127 |
-
|
| 128 |
-
trend_category_dropdown.change(
|
| 129 |
-
fn=update_trend_chart,
|
| 130 |
-
inputs=[trend_category_dropdown, nickname_input],
|
| 131 |
-
outputs=[trend_chart]
|
| 132 |
-
)
|
| 133 |
|
| 134 |
milestone_box = gr.Markdown(visible=False)
|
| 135 |
|
|
@@ -187,4 +167,19 @@ def spoken_dashboard(nickname_input):
|
|
| 187 |
inputs=[hidden_transcript, language_dropdown],
|
| 188 |
outputs=example_box)
|
| 189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
return spoken_panel
|
|
|
|
| 84 |
goal_dropdown = gr.Dropdown(label="π― Goal", choices=["Interview preparation", "Public speaking", "Class presentation", "General improvement"], value="General improvement")
|
| 85 |
focus_checkboxes = gr.CheckboxGroup(label="π§ Focus Areas", choices=["Clarity", "Structure", "Fluency", "Tone", "Content Relevance"], value=["Clarity", "Structure", "Fluency", "Tone", "Content Relevance"])
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
with gr.Row():
|
| 88 |
audio_input = gr.Audio(type="filepath", label="π Speak or Upload Audio")
|
| 89 |
audio_output = gr.Audio(label="π Chatter's Response", type="filepath")
|
|
|
|
| 100 |
history_table = gr.Dataframe(headers=["π Timestamp", "π Language", "π Transcript", "π¬ Feedback"])
|
| 101 |
|
| 102 |
with gr.Row():
|
| 103 |
+
with gr.Column(scale=1):
|
| 104 |
+
gr.Markdown("### π Score Comparison")
|
| 105 |
+
score_chart = gr.Plot()
|
| 106 |
+
with gr.Column(scale=1):
|
| 107 |
+
trend_category_dropdown = gr.Dropdown(
|
| 108 |
+
label="π Track Progress In",
|
| 109 |
+
choices=["Clarity", "Structure", "Fluency", "Tone", "Content Relevance"],
|
| 110 |
+
value="Tone"
|
| 111 |
+
)
|
| 112 |
+
trend_chart = gr.Plot(label="Progress Over Time")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
milestone_box = gr.Markdown(visible=False)
|
| 115 |
|
|
|
|
| 167 |
inputs=[hidden_transcript, language_dropdown],
|
| 168 |
outputs=example_box)
|
| 169 |
|
| 170 |
+
def update_trend_chart(trend_category, nickname):
|
| 171 |
+
if hasattr(nickname, "value"):
|
| 172 |
+
nickname = nickname.value
|
| 173 |
+
sessions = fetch_user_sessions(nickname)
|
| 174 |
+
dates, trend_scores = build_trend_data(sessions, trend_category)
|
| 175 |
+
if trend_scores:
|
| 176 |
+
return render_trend_chart(dates, trend_scores, trend_category)
|
| 177 |
+
return render_empty_chart(f"π {trend_category} Progress")
|
| 178 |
+
|
| 179 |
+
trend_category_dropdown.change(
|
| 180 |
+
fn=update_trend_chart,
|
| 181 |
+
inputs=[trend_category_dropdown, nickname_input],
|
| 182 |
+
outputs=[trend_chart]
|
| 183 |
+
)
|
| 184 |
+
|
| 185 |
return spoken_panel
|