Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,23 +37,25 @@ def generate_unique_feedback(text):
|
|
| 37 |
# Reset history function for Gradio button
|
| 38 |
def reset_history():
|
| 39 |
global feedback_history
|
| 40 |
-
feedback_history = []
|
| 41 |
return "Feedback history has been reset."
|
| 42 |
|
| 43 |
# Set up Gradio interface using Blocks
|
| 44 |
with gr.Blocks() as app:
|
| 45 |
gr.Markdown("# WriteBetter\nQuick feedback on tone, grammar, and word choice.")
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
feedback_button = gr.Button("Generate Feedback")
|
| 52 |
feedback_button.click(fn=generate_unique_feedback, inputs=input_text, outputs=feedback_output)
|
| 53 |
|
| 54 |
-
|
|
|
|
|
|
|
| 55 |
reset_button = gr.Button("Reset Feedback History")
|
| 56 |
-
reset_button.click(fn=reset_history, outputs=
|
| 57 |
|
| 58 |
# Launch the app
|
| 59 |
app.launch()
|
|
|
|
| 37 |
# Reset history function for Gradio button
|
| 38 |
def reset_history():
|
| 39 |
global feedback_history
|
| 40 |
+
feedback_history = [] # Clear the history
|
| 41 |
return "Feedback history has been reset."
|
| 42 |
|
| 43 |
# Set up Gradio interface using Blocks
|
| 44 |
with gr.Blocks() as app:
|
| 45 |
gr.Markdown("# WriteBetter\nQuick feedback on tone, grammar, and word choice.")
|
| 46 |
+
|
| 47 |
+
with gr.Row():
|
| 48 |
+
input_text = gr.Textbox(lines=5, label="Your Writing", placeholder="Paste a short piece of creative writing here...")
|
| 49 |
+
feedback_output = gr.Textbox(label="Feedback")
|
| 50 |
+
|
| 51 |
feedback_button = gr.Button("Generate Feedback")
|
| 52 |
feedback_button.click(fn=generate_unique_feedback, inputs=input_text, outputs=feedback_output)
|
| 53 |
|
| 54 |
+
with gr.Row():
|
| 55 |
+
reset_status = gr.Textbox(label="Reset Status", interactive=False)
|
| 56 |
+
|
| 57 |
reset_button = gr.Button("Reset Feedback History")
|
| 58 |
+
reset_button.click(fn=reset_history, outputs=reset_status)
|
| 59 |
|
| 60 |
# Launch the app
|
| 61 |
app.launch()
|