VyLala commited on
Commit
2634847
·
verified ·
1 Parent(s): ebaa940

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -76,7 +76,7 @@ with gr.Blocks() as interface:
76
  nps_question = gr.Markdown("### How likely are you to recommend this tool to a colleague or peer (0 = Not at all, 10 = Definitely)?")
77
  nps_slider = gr.Slider(minimum=0, maximum=10, step=1, label="Your NPS Score (0-10)")
78
  nps_button = gr.Button("Submit")
79
- #nps_output = gr.Textbox(label="Thanks for your feedback!")
80
 
81
  download_file = gr.File(label="Download File Here", visible=False, interactive=True)
82
  progress_box = gr.Textbox(label="Live Processing Log", lines=20, interactive=False)
@@ -297,9 +297,11 @@ with gr.Blocks() as interface:
297
  # "\n".join(log_lines)
298
  # )
299
  def submit_nps(email,nps_score):
300
- log_submission_to_gsheet(email,[],nps_score)
301
- return " Submitted successfully!"
302
- #return nps_output
 
 
303
  def log_submission_to_gsheet(email, samples, nps_score=None):
304
  from datetime import datetime, timezone
305
  import json, os, gspread
@@ -701,7 +703,7 @@ with gr.Blocks() as interface:
701
  gr.update(visible=False), # submit_report_button
702
  gr.update(value="", visible=False), # status_report
703
  gr.update(value=0), # nps_slider
704
- #gr.update(value="", visible=True) # nps_output
705
 
706
  )
707
 
@@ -788,7 +790,7 @@ with gr.Blocks() as interface:
788
  outputs=[raw_text, file_upload, output_table, status, results_group, usage_display, progress_box,
789
  report_textbox,
790
  submit_report_button,
791
- status_report, nps_slider]
792
  )
793
 
794
  # download_button.click(
 
76
  nps_question = gr.Markdown("### How likely are you to recommend this tool to a colleague or peer (0 = Not at all, 10 = Definitely)?")
77
  nps_slider = gr.Slider(minimum=0, maximum=10, step=1, label="Your NPS Score (0-10)")
78
  nps_button = gr.Button("Submit")
79
+ nps_output = gr.Textbox(label="", interactive=False, visible=True) # Start empty
80
 
81
  download_file = gr.File(label="Download File Here", visible=False, interactive=True)
82
  progress_box = gr.Textbox(label="Live Processing Log", lines=20, interactive=False)
 
297
  # "\n".join(log_lines)
298
  # )
299
  def submit_nps(email,nps_score):
300
+ if nps_score is None:
301
+ return " Please select a score before submitting."
302
+ log_submission_to_gsheet(email, [], nps_score)
303
+ return "✅ Thanks for submitting your feedback!"
304
+
305
  def log_submission_to_gsheet(email, samples, nps_score=None):
306
  from datetime import datetime, timezone
307
  import json, os, gspread
 
703
  gr.update(visible=False), # submit_report_button
704
  gr.update(value="", visible=False), # status_report
705
  gr.update(value=0), # nps_slider
706
+ gr.update(value="", visible=False) # nps_output
707
 
708
  )
709
 
 
790
  outputs=[raw_text, file_upload, output_table, status, results_group, usage_display, progress_box,
791
  report_textbox,
792
  submit_report_button,
793
+ status_report, nps_slider, nps_output]
794
  )
795
 
796
  # download_button.click(