yasserrmd commited on
Commit
55ccbf7
·
verified ·
1 Parent(s): a9932e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -40,17 +40,20 @@ def reset_history():
40
  feedback_history = []
41
  return "Feedback history has been reset."
42
 
43
- # Set up the Gradio interface with the updated syntax
44
- app = gr.Interface(
45
- fn=generate_unique_feedback,
46
- inputs=gr.Textbox(lines=5, label="Your Writing", placeholder="Paste a short piece of creative writing here..."),
47
- outputs=gr.Textbox(label="Feedback"),
48
- title="WriteBetter",
49
- description="Quick feedback on tone, grammar, and word choice.",
50
- )
51
-
52
- # Add a reset button to clear feedback history
53
- app = app.add_component(gr.Button("Reset Feedback History"), reset_history)
 
 
 
54
 
55
  # Launch the app
56
  app.launch()
 
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
+ input_text = gr.Textbox(lines=5, label="Your Writing", placeholder="Paste a short piece of creative writing here...")
47
+ feedback_output = gr.Textbox(label="Feedback")
48
+ reset_output = gr.Textbox(label="Reset Status", interactive=False)
49
+
50
+ # Generate feedback button
51
+ feedback_button = gr.Button("Generate Feedback")
52
+ feedback_button.click(fn=generate_unique_feedback, inputs=input_text, outputs=feedback_output)
53
+
54
+ # Reset history button
55
+ reset_button = gr.Button("Reset Feedback History")
56
+ reset_button.click(fn=reset_history, outputs=reset_output)
57
 
58
  # Launch the app
59
  app.launch()