Carbaz commited on
Commit
36f9f0f
·
1 Parent(s): 7662760

Refactor parameter names for clarity: update 'cv_pdf' to 'profile_pdf' in main, Assistant, and get_interface functions

Browse files
Files changed (4) hide show
  1. app.py +3 -3
  2. src/__main__.py +5 -5
  3. src/assistant.py +3 -3
  4. src/interface.py +2 -2
app.py CHANGED
@@ -4,8 +4,8 @@ from src.__main__ import main
4
 
5
 
6
  name = "Carlos Bazaga"
7
- cv_pdf = "linkedin.pdf"
8
- summary_txt = "summary.txt"
9
  repo_id = "Carbaz/career_datastore"
10
 
11
  # HBD: We assign the 'app' to 'demo' to allow watch autoreload:
@@ -13,4 +13,4 @@ repo_id = "Carbaz/career_datastore"
13
  # Initial warnings may appear at launch with 'gradio app.py' because 'demo' will not
14
  # exists until the app service ends inside main, but it will do when reload requires it,
15
  # once the service has been stopped.
16
- demo = main(name, cv_pdf, summary_txt, repo_id)
 
4
 
5
 
6
  name = "Carlos Bazaga"
7
+ profile_pdf = "Profile.pdf"
8
+ summary_text = "Summary.md"
9
  repo_id = "Carbaz/career_datastore"
10
 
11
  # HBD: We assign the 'app' to 'demo' to allow watch autoreload:
 
13
  # Initial warnings may appear at launch with 'gradio app.py' because 'demo' will not
14
  # exists until the app service ends inside main, but it will do when reload requires it,
15
  # once the service has been stopped.
16
+ demo = main(name, profile_pdf, summary_text, repo_id)
src/__main__.py CHANGED
@@ -10,10 +10,10 @@ from .interface import get_interface
10
  _logger = getLogger(__name__)
11
 
12
 
13
- def main(name, cv_pdf, summary_text, repo_id):
14
  """Launch the AI Career Digital Twin application."""
15
  _logger.info('STARTING AI CAREER DIGITAL TWIN...')
16
- app = get_interface(name, cv_pdf, summary_text, repo_id)
17
  app.launch(footer_links=["gradio"])
18
  # We return the app instance for potential use in autoreload scenarios.
19
  return app
@@ -21,7 +21,7 @@ def main(name, cv_pdf, summary_text, repo_id):
21
 
22
  if __name__ == '__main__':
23
  name = "Carlos Bazaga"
24
- cv_pdf = "linkedin.pdf"
25
- summary_text = "summary.md"
26
  repo_id = "Carbaz/career_datastore"
27
- main(name, cv_pdf, summary_text, repo_id)
 
10
  _logger = getLogger(__name__)
11
 
12
 
13
+ def main(name, profile_pdf, summary_text, repo_id):
14
  """Launch the AI Career Digital Twin application."""
15
  _logger.info('STARTING AI CAREER DIGITAL TWIN...')
16
+ app = get_interface(name, profile_pdf, summary_text, repo_id)
17
  app.launch(footer_links=["gradio"])
18
  # We return the app instance for potential use in autoreload scenarios.
19
  return app
 
21
 
22
  if __name__ == '__main__':
23
  name = "Carlos Bazaga"
24
+ profile_pdf = "Profile.pdf"
25
+ summary_text = "Summary.md"
26
  repo_id = "Carbaz/career_datastore"
27
+ main(name, profile_pdf, summary_text, repo_id)
src/assistant.py CHANGED
@@ -21,14 +21,14 @@ CHAT_MODEL = getenv("CHAT_MODEL", "gpt-5-mini")
21
  class Assistant:
22
  """Class representing myself for the chatbot."""
23
 
24
- def __init__(self, name, cv_pdf_filename, summary_filename, repo_id):
25
  """Initialize the Assistant class by loading profile and summary."""
26
  self.name = name
27
  self.openai = OpenAI()
28
  # Download PDF CV from Hugging Face Hub and extract text.
29
- self.linkedin = read_pdf_from_hub(repo_id, cv_pdf_filename)
30
  # Download Summary from Hugging Face Hub and read text.
31
- self.summary = read_text_from_hub(repo_id, summary_filename)
32
 
33
  def handle_tool_call(self, tool_calls):
34
  """Handle tool calls made by the AI model."""
 
21
  class Assistant:
22
  """Class representing myself for the chatbot."""
23
 
24
+ def __init__(self, name, profile_pdf, summary_text, repo_id):
25
  """Initialize the Assistant class by loading profile and summary."""
26
  self.name = name
27
  self.openai = OpenAI()
28
  # Download PDF CV from Hugging Face Hub and extract text.
29
+ self.linkedin = read_pdf_from_hub(repo_id, profile_pdf)
30
  # Download Summary from Hugging Face Hub and read text.
31
+ self.summary = read_text_from_hub(repo_id, summary_text)
32
 
33
  def handle_tool_call(self, tool_calls):
34
  """Handle tool calls made by the AI model."""
src/interface.py CHANGED
@@ -30,7 +30,7 @@ else:
30
  MY_CHAT_SECRET = "".join(choice(ascii_letters + digits) for _ in range(16))
31
 
32
 
33
- def get_interface(name, cv_pdf, summary_text, repo_id):
34
  """Get the Gradio ChatInterface for the AI Career Digital Twin."""
35
  match gr_version[0]:
36
  case "5":
@@ -51,7 +51,7 @@ def get_interface(name, cv_pdf, summary_text, repo_id):
51
  **chat_bot_conf)
52
 
53
  app = ChatInterface(Assistant(
54
- name, cv_pdf, summary_text, repo_id).chat,
55
  chatbot=my_chatbot, autofocus=False, **chat_ifz_conf,
56
  save_history=True, title="Carlos Bazaga's virtual CV")
57
 
 
30
  MY_CHAT_SECRET = "".join(choice(ascii_letters + digits) for _ in range(16))
31
 
32
 
33
+ def get_interface(name, profile_pdf, summary_text, repo_id):
34
  """Get the Gradio ChatInterface for the AI Career Digital Twin."""
35
  match gr_version[0]:
36
  case "5":
 
51
  **chat_bot_conf)
52
 
53
  app = ChatInterface(Assistant(
54
+ name, profile_pdf, summary_text, repo_id).chat,
55
  chatbot=my_chatbot, autofocus=False, **chat_ifz_conf,
56
  save_history=True, title="Carlos Bazaga's virtual CV")
57