VyLala commited on
Commit
6c4c0dd
·
verified ·
1 Parent(s): 667073b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -56,11 +56,6 @@ with gr.Blocks() as interface:
56
  # output_flag = gr.Markdown(elem_id="output-flag")
57
 
58
  # gr.Markdown("---")
59
-
60
- nps_question = gr.Markdown("#### 📝 How likely are you to recommend this tool to a colleague or peer (0 = Not at all, 10 = Definitely)?")
61
- nps_slider = gr.Slider(minimum=0, maximum=10, step=1, label="Your NPS Score (0-10)")
62
- nps_button = gr.Button("Submit NPS")
63
- nps_output = gr.Textbox(label="Thanks for your feedback!")
64
 
65
  with gr.Accordion("Open to See the Output Table", open=False) as table_accordion:
66
  output_table = gr.HTML(render=True)
@@ -68,6 +63,11 @@ with gr.Blocks() as interface:
68
  #output_type = gr.Dropdown(choices=["Excel", "JSON", "TXT"], label="Select Output Format", value="Excel")
69
  #download_button = gr.Button("⬇️ Download Output")
70
  #download_file = gr.File(label="Download File Here",visible=False)
 
 
 
 
 
71
  report_button = gr.Button("Report")
72
  report_textbox = gr.Textbox(
73
  label="Describe the issue",
@@ -323,6 +323,7 @@ with gr.Blocks() as interface:
323
  samples_col = headers.index("samples")
324
  recent_time_col = headers.index("recent_time")
325
  nps_col = headers.index("nps_score") if "nps_score" in headers else -1
 
326
  # Step 1: Find row matching the email
327
  for i, row in enumerate(data[1:], start=2): # start=2 for correct row indexing
328
  if row[email_col].strip().lower() == email.strip().lower():
@@ -341,6 +342,7 @@ with gr.Blocks() as interface:
341
  worksheet.update_cell(i, samples_col + 1, new_sample_string)
342
  worksheet.update_cell(i, recent_time_col + 1, new_timestamp)
343
  if nps_score is not None:
 
344
  worksheet.update_cell(i, nps_col + 1, str(nps_score))
345
  print(f"✅ Updated existing user row for: {email}")
346
  return
@@ -696,7 +698,11 @@ with gr.Blocks() as interface:
696
  gr.update(value="", visible=False), # report_textbox
697
  gr.update(visible=False), # submit_report_button
698
  gr.update(value="", visible=False), # status_report
 
 
 
699
  )
 
700
  #inputMode.change(fn=toggle_input_mode, inputs=inputMode, outputs=[single_input_group, batch_input_group])
701
  #run_button.click(fn=classify_with_loading, inputs=[], outputs=[status])
702
  # run_button.click(
@@ -780,7 +786,7 @@ with gr.Blocks() as interface:
780
  outputs=[raw_text, file_upload, output_table, status, results_group, usage_display, progress_box,
781
  report_textbox,
782
  submit_report_button,
783
- status_report]
784
  )
785
 
786
  # download_button.click(
 
56
  # output_flag = gr.Markdown(elem_id="output-flag")
57
 
58
  # gr.Markdown("---")
 
 
 
 
 
59
 
60
  with gr.Accordion("Open to See the Output Table", open=False) as table_accordion:
61
  output_table = gr.HTML(render=True)
 
63
  #output_type = gr.Dropdown(choices=["Excel", "JSON", "TXT"], label="Select Output Format", value="Excel")
64
  #download_button = gr.Button("⬇️ Download Output")
65
  #download_file = gr.File(label="Download File Here",visible=False)
66
+ nps_question = gr.Markdown("#### 📝 How likely are you to recommend this tool to a colleague or peer (0 = Not at all, 10 = Definitely)?")
67
+ nps_slider = gr.Slider(minimum=0, maximum=10, step=1, label="Your NPS Score (0-10)")
68
+ nps_button = gr.Button("Submit NPS")
69
+ nps_output = gr.Textbox(label="Thanks for your feedback!")
70
+
71
  report_button = gr.Button("Report")
72
  report_textbox = gr.Textbox(
73
  label="Describe the issue",
 
323
  samples_col = headers.index("samples")
324
  recent_time_col = headers.index("recent_time")
325
  nps_col = headers.index("nps_score") if "nps_score" in headers else -1
326
+ print("this is nps col: ", nps_col)
327
  # Step 1: Find row matching the email
328
  for i, row in enumerate(data[1:], start=2): # start=2 for correct row indexing
329
  if row[email_col].strip().lower() == email.strip().lower():
 
342
  worksheet.update_cell(i, samples_col + 1, new_sample_string)
343
  worksheet.update_cell(i, recent_time_col + 1, new_timestamp)
344
  if nps_score is not None:
345
+ print("this is nps score:", nps_score)
346
  worksheet.update_cell(i, nps_col + 1, str(nps_score))
347
  print(f"✅ Updated existing user row for: {email}")
348
  return
 
698
  gr.update(value="", visible=False), # report_textbox
699
  gr.update(visible=False), # submit_report_button
700
  gr.update(value="", visible=False), # status_report
701
+ gr.update(value=0), # nps_slider
702
+ gr.update(value="", visible=True) # nps_output
703
+
704
  )
705
+
706
  #inputMode.change(fn=toggle_input_mode, inputs=inputMode, outputs=[single_input_group, batch_input_group])
707
  #run_button.click(fn=classify_with_loading, inputs=[], outputs=[status])
708
  # run_button.click(
 
786
  outputs=[raw_text, file_upload, output_table, status, results_group, usage_display, progress_box,
787
  report_textbox,
788
  submit_report_button,
789
+ status_report, nps_slider, nps_output]
790
  )
791
 
792
  # download_button.click(