hallisky commited on
Commit
f2a701f
1 Parent(s): e511669

Fix warning messages

Browse files
Files changed (2) hide show
  1. app.py +5 -4
  2. utils.py +5 -2
app.py CHANGED
@@ -337,15 +337,16 @@ with demo:
337
  inputs=[input_text] + sliders,
338
  outputs=[output, feedback_rating, feedback_text, latest_obfuscation])
339
 
340
- save_feedback_button = gr.Button("Save Feedback", interactive=False)
341
 
342
- feedback_warning_message = gr.Markdown(
343
- "<div style='text-align: center; color: red;'>⚠️ Please provide feedback or a rating before submitting. ⚠️</div>", visible=True
344
- )
345
  confirmation_message = gr.Markdown(
346
  "<div id='confirmation-message' style='text-align: center; color: green;'>🥳 Feedback has been submitted successfully! 🎊</div>", visible=False
347
  )
348
 
 
 
 
 
349
  # Update the interactivity of the save_feedback_button based on feedback_rating and feedback_text
350
  feedback_rating.change(fn=update_save_feedback_button, inputs=[feedback_rating, feedback_text], outputs=[save_feedback_button, feedback_warning_message])
351
  feedback_text.change(fn=update_save_feedback_button, inputs=[feedback_rating, feedback_text], outputs=[save_feedback_button, feedback_warning_message])
 
337
  inputs=[input_text] + sliders,
338
  outputs=[output, feedback_rating, feedback_text, latest_obfuscation])
339
 
340
+ save_feedback_button = gr.Button("Submit Feedback", interactive=False)
341
 
 
 
 
342
  confirmation_message = gr.Markdown(
343
  "<div id='confirmation-message' style='text-align: center; color: green;'>🥳 Feedback has been submitted successfully! 🎊</div>", visible=False
344
  )
345
 
346
+ feedback_warning_message = gr.Markdown(
347
+ "<div id='feedback-warning' style='text-align: center; color: red;'>⚠️ Please provide feedback or a rating before submitting. ⚠️</div>", visible=True
348
+ )
349
+
350
  # Update the interactivity of the save_feedback_button based on feedback_rating and feedback_text
351
  feedback_rating.change(fn=update_save_feedback_button, inputs=[feedback_rating, feedback_text], outputs=[save_feedback_button, feedback_warning_message])
352
  feedback_text.change(fn=update_save_feedback_button, inputs=[feedback_rating, feedback_text], outputs=[save_feedback_button, feedback_warning_message])
utils.py CHANGED
@@ -1,15 +1,18 @@
1
  hide_code = """
2
  () => {
3
  const confirmationMessage = document.getElementById('confirmation-message');
 
4
  confirmationMessage.style.display = 'block';
5
  confirmationMessage.style.opacity = 1;
 
6
  setTimeout(() => {
7
- confirmationMessage.style.transition = 'opacity 8s';
8
  confirmationMessage.style.opacity = 0;
9
  }, 1000);
10
  setTimeout(() => {
11
  confirmationMessage.style.display = 'none';
12
- }, 9200); // 2000ms for transition
 
13
  }
14
  """
15
 
 
1
  hide_code = """
2
  () => {
3
  const confirmationMessage = document.getElementById('confirmation-message');
4
+ const feedbackWarning = document.getElementById('feedback-warning');
5
  confirmationMessage.style.display = 'block';
6
  confirmationMessage.style.opacity = 1;
7
+ feedbackWarning.style.display = 'none';
8
  setTimeout(() => {
9
+ confirmationMessage.style.transition = 'opacity 5s';
10
  confirmationMessage.style.opacity = 0;
11
  }, 1000);
12
  setTimeout(() => {
13
  confirmationMessage.style.display = 'none';
14
+ feedbackWarning.style.display = 'block';
15
+ }, 6200); // 2000ms for transition
16
  }
17
  """
18