Update written_module.py
Browse files- written_module.py +7 -4
written_module.py
CHANGED
|
@@ -60,19 +60,22 @@ def written_dashboard(nickname):
|
|
| 60 |
with gr.Column() as written_panel:
|
| 61 |
gr.Markdown("""
|
| 62 |
<div id="header" style="text-align: center;">
|
|
|
|
| 63 |
<h2>βοΈ Written Communication with <strong>Chatter the Owl</strong></h2>
|
| 64 |
<p>Paste or upload your writing. Select your goal and focus, and receive detailed feedback, improvement, and progress tracking.</p>
|
| 65 |
</div>
|
| 66 |
""")
|
| 67 |
|
| 68 |
-
with gr.Row(
|
| 69 |
language_dropdown = gr.Dropdown(label="π Language", choices=list(LANG_CODES.keys()), value="English")
|
| 70 |
goal_dropdown = gr.Dropdown(label="π― Writing Goal", choices=["Essay for school", "Job application", "Blog post", "Creative writing", "General improvement"], value="General improvement")
|
| 71 |
focus_checkboxes = gr.CheckboxGroup(label="π§ Focus Areas", choices=["Clarity", "Organization", "Grammar", "Vocabulary", "Tone", "Creativity"], value=["Clarity", "Organization", "Grammar", "Vocabulary", "Tone", "Creativity"])
|
| 72 |
|
| 73 |
-
with gr.Row(
|
| 74 |
input_text = gr.Textbox(label="π Your Writing", lines=8, elem_id="input_text", elem_classes=["text_area"])
|
| 75 |
-
|
|
|
|
|
|
|
| 76 |
|
| 77 |
feedback_box = gr.Textbox(label="π‘ Feedback", interactive=False, elem_id="feedback_box")
|
| 78 |
improved_box = gr.Textbox(label="π― Improved Version", interactive=False, elem_id="improved_box")
|
|
@@ -115,7 +118,7 @@ def written_dashboard(nickname):
|
|
| 115 |
|
| 116 |
return feedback, improved, session_table, score_plot, trend_plot, gr.update(visible=bool(milestone_msg), value=milestone_msg)
|
| 117 |
|
| 118 |
-
|
| 119 |
fn=tutor_written,
|
| 120 |
inputs=[input_text, language_dropdown, goal_dropdown, focus_checkboxes],
|
| 121 |
outputs=[feedback_box, improved_box, history_table, score_chart, trend_chart, milestone_box]
|
|
|
|
| 60 |
with gr.Column() as written_panel:
|
| 61 |
gr.Markdown("""
|
| 62 |
<div id="header" style="text-align: center;">
|
| 63 |
+
<img src="file/images/chatter_owl.png" width="120">
|
| 64 |
<h2>βοΈ Written Communication with <strong>Chatter the Owl</strong></h2>
|
| 65 |
<p>Paste or upload your writing. Select your goal and focus, and receive detailed feedback, improvement, and progress tracking.</p>
|
| 66 |
</div>
|
| 67 |
""")
|
| 68 |
|
| 69 |
+
with gr.Row():
|
| 70 |
language_dropdown = gr.Dropdown(label="π Language", choices=list(LANG_CODES.keys()), value="English")
|
| 71 |
goal_dropdown = gr.Dropdown(label="π― Writing Goal", choices=["Essay for school", "Job application", "Blog post", "Creative writing", "General improvement"], value="General improvement")
|
| 72 |
focus_checkboxes = gr.CheckboxGroup(label="π§ Focus Areas", choices=["Clarity", "Organization", "Grammar", "Vocabulary", "Tone", "Creativity"], value=["Clarity", "Organization", "Grammar", "Vocabulary", "Tone", "Creativity"])
|
| 73 |
|
| 74 |
+
with gr.Row():
|
| 75 |
input_text = gr.Textbox(label="π Your Writing", lines=8, elem_id="input_text", elem_classes=["text_area"])
|
| 76 |
+
submit_button = gr.Button("π Submit", variant="primary")
|
| 77 |
+
|
| 78 |
+
file_input = gr.File(label="π Upload Text File", file_types=[".txt", ".md"])
|
| 79 |
|
| 80 |
feedback_box = gr.Textbox(label="π‘ Feedback", interactive=False, elem_id="feedback_box")
|
| 81 |
improved_box = gr.Textbox(label="π― Improved Version", interactive=False, elem_id="improved_box")
|
|
|
|
| 118 |
|
| 119 |
return feedback, improved, session_table, score_plot, trend_plot, gr.update(visible=bool(milestone_msg), value=milestone_msg)
|
| 120 |
|
| 121 |
+
submit_button.click(
|
| 122 |
fn=tutor_written,
|
| 123 |
inputs=[input_text, language_dropdown, goal_dropdown, focus_checkboxes],
|
| 124 |
outputs=[feedback_box, improved_box, history_table, score_chart, trend_chart, milestone_box]
|