JanviMl commited on
Commit
558e729
·
verified ·
1 Parent(s): a91c478

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -204,6 +204,11 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
204
  feedback_submit = gr.Button("Submit Feedback")
205
  feedback_output = gr.Textbox(label="Feedback Status")
206
 
 
 
 
 
 
207
  def handle_classification(comment, history):
208
  if history is None:
209
  history = []
@@ -289,6 +294,14 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
289
 
290
  return f"Thank you for your feedback: {feedback}\nAdditional comment: {additional_comment if additional_comment else 'None'}\nFeedback has been saved."
291
 
 
 
 
 
 
 
 
 
292
  submit_btn.click(
293
  fn=lambda: (
294
  "Classifying... <span class='loading'>⏳</span>", 0, "", None, "", "",
@@ -342,6 +355,12 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
342
  ]
343
  )
344
 
 
 
 
 
 
 
345
  gr.Markdown(
346
  """
347
  ---
 
204
  feedback_submit = gr.Button("Submit Feedback")
205
  feedback_output = gr.Textbox(label="Feedback Status")
206
 
207
+ with gr.Row():
208
+ with gr.Column():
209
+ refine_btn = gr.Button("Run Iterative Refinement (Stage 4)", variant="primary")
210
+ refine_status = gr.Textbox(label="Refinement Status", placeholder="Status will appear here...")
211
+
212
  def handle_classification(comment, history):
213
  if history is None:
214
  history = []
 
294
 
295
  return f"Thank you for your feedback: {feedback}\nAdditional comment: {additional_comment if additional_comment else 'None'}\nFeedback has been saved."
296
 
297
+ def run_refinement():
298
+ try:
299
+ from refine_paraphrases import main
300
+ main()
301
+ return "Refinement complete. Results saved to iterated_paraphrases.csv and pushed to JanviMl/toxi_iterated_paraphrases."
302
+ except Exception as e:
303
+ return f"Error running refinement: {str(e)}"
304
+
305
  submit_btn.click(
306
  fn=lambda: (
307
  "Classifying... <span class='loading'>⏳</span>", 0, "", None, "", "",
 
355
  ]
356
  )
357
 
358
+ refine_btn.click(
359
+ fn=run_refinement,
360
+ inputs=[],
361
+ outputs=[refine_status]
362
+ )
363
+
364
  gr.Markdown(
365
  """
366
  ---