barbara-multimodal commited on
Commit
87afed1
·
1 Parent(s): d60680f

feat: Add functions for pop-up generation and reset logic

Browse files
Files changed (1) hide show
  1. src/utils.py +41 -1
src/utils.py CHANGED
@@ -1,6 +1,7 @@
1
  import random
2
  import requests
3
  from bs4 import BeautifulSoup
 
4
  from .constants import API_KEY
5
 
6
  def remove_html_tags(text):
@@ -29,4 +30,43 @@ def api_call(url, payload, headers=None):
29
  return "Error: Unable to reach the API or invalid response received."
30
 
31
  def generate_session_id():
32
- return random.randint(3000, 20000)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import random
2
  import requests
3
  from bs4 import BeautifulSoup
4
+
5
  from .constants import API_KEY
6
 
7
  def remove_html_tags(text):
 
30
  return "Error: Unable to reach the API or invalid response received."
31
 
32
  def generate_session_id():
33
+ return random.randint(3000, 20000)
34
+
35
+ def highlight_feedback(feedback_output):
36
+ if not feedback_output["feedback_by_category"]:
37
+ return False, [(feedback_output["feedback_text"], None)]
38
+ return True, [(item["text"], item["category"]) for item in feedback_output["feedback_by_category"]]
39
+
40
+ def show_popup(selected_resume, selected_company):
41
+ if selected_resume:
42
+ return """<div id="popup-resume" style="position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%);
43
+ background-color: #fffaf0; border: 2px solid #ffa500; padding: 20px;
44
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); border-radius: 10px; z-index: 1000;
45
+ color: #ff6700; font-family: Arial, sans-serif; text-align: center;">
46
+ <p><strong>Notice:</strong> You selected the option to include the candidate's resume.</p>
47
+ <p><a href='https://huggingface.co/spaces/multimodalai/talent-interview-prep/blob/main/resources/Senior_Product_Manager_Resume.txt'
48
+ style='color: #ff6700; text-decoration: none; font-weight: bold;' target="_blank">
49
+ Click here to view the Senior Product Manager's Resume</a></p>
50
+ <button onclick="document.getElementById('popup-resume').remove();"
51
+ style="background-color: #ff6700; color: white; border: none;
52
+ padding: 5px 10px; border-radius: 5px; cursor: pointer;">
53
+ Close
54
+ </button>
55
+ </div>"""
56
+ elif selected_company:
57
+ return f"""<div id="popup-company" style="position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%);
58
+ background-color: #fffaf0; border: 2px solid #ffa500; padding: 20px;
59
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); border-radius: 10px; z-index: 1000;
60
+ color: #ff6700; font-family: Arial, sans-serif; text-align: center;">
61
+ <p><strong>Notice:</strong> You selected the option to include the company name in the request.</p>
62
+ <p>The company name is: <strong>InnovateTech Solutions</strong>.</p>
63
+ <button onclick="document.getElementById('popup-company').remove();"
64
+ style="background-color: #ff6700; color: white; border: none;
65
+ padding: 5px 10px; border-radius: 5px; cursor: pointer;">
66
+ Close
67
+ </button>
68
+ </div>"""
69
+ return ""
70
+
71
+ def reset_popup():
72
+ return ""