cxumol commited on
Commit
b6ccc9b
2 Parent(s): de07305 4d5cf91

Merge branch 'main' of https://github.com/cxumol/CoverPilot

Browse files
Files changed (4) hide show
  1. README.md +2 -2
  2. app/app.py +2 -2
  3. app/config.py +2 -2
  4. app/util.py +6 -3
README.md CHANGED
@@ -24,7 +24,7 @@ short_description: AI-Powered Cover Letter Generator
24
  🎩 **CoverPilot** is an AI-powered cover letter generator. It helps you focus on what matters most - getting the job.
25
 
26
  [Watch process in action](#demo) |
27
- [How it can help](#workflow) |
28
  [Deploy your own](#setup)
29
 
30
  ![sync_to_HF](https://github.com/cxumol/CoverPilot/actions/workflows/hf_sync.yml/badge.svg) |
@@ -40,7 +40,7 @@ https://github.com/cxumol/CoverPilot/assets/8279655/fe66bc9a-8d05-4f69-b3f5-b48f
40
 
41
  - Try it on Hugging Face now! [![Hugging Face](https://img.shields.io/badge/App%20Hosted%20on-%F0%9F%A4%97%20Hugging%20Face-blue)](https://huggingface.co/spaces/cxumol/CoverPilot)
42
 
43
- ## Workflow
44
 
45
  With powerful Prompt Engineering, CoverPilot can deeply understand your resume and the job description, and find the best writing style to match your experience with the job.
46
 
 
24
  🎩 **CoverPilot** is an AI-powered cover letter generator. It helps you focus on what matters most - getting the job.
25
 
26
  [Watch process in action](#demo) |
27
+ [How it can help](#mechanism) |
28
  [Deploy your own](#setup)
29
 
30
  ![sync_to_HF](https://github.com/cxumol/CoverPilot/actions/workflows/hf_sync.yml/badge.svg) |
 
40
 
41
  - Try it on Hugging Face now! [![Hugging Face](https://img.shields.io/badge/App%20Hosted%20on-%F0%9F%A4%97%20Hugging%20Face-blue)](https://huggingface.co/spaces/cxumol/CoverPilot)
42
 
43
+ ## Mechanism
44
 
45
  With powerful Prompt Engineering, CoverPilot can deeply understand your resume and the job description, and find the best writing style to match your experience with the job.
46
 
app/app.py CHANGED
@@ -75,7 +75,7 @@ def set_same_cheap_strong(
75
 
76
  def check_API_Key_provision(cheap_key, strong_key):
77
  if not cheap_key or not strong_key:
78
- raise ValueError("API Key is not provided. You can get one from https://beta.openai.com/account/api-keys. Please read the in-App guide carefully before you start.")
79
 
80
  ## Main Functions
81
 
@@ -162,7 +162,7 @@ with gr.Blocks(
162
  intro = f"""# {DEMO_TITLE}
163
  > You provide job description and résumé, and I write Cover letter for you!
164
 
165
- **IMPORTANT** In order to enable AI capability, you have to ***BRING YOUR OWN API Key***.
166
  """
167
  gr.Markdown(intro)
168
  with gr.Accordion("=== IMPORTANT: READ ME FIRST ===", open=False):
 
75
 
76
  def check_API_Key_provision(cheap_key, strong_key):
77
  if not cheap_key or not strong_key:
78
+ raise ValueError("Please set your API Key before you start. You can get one from https://beta.openai.com/account/api-keys. Please read the in-App guide carefully.")
79
 
80
  ## Main Functions
81
 
 
162
  intro = f"""# {DEMO_TITLE}
163
  > You provide job description and résumé, and I write Cover letter for you!
164
 
165
+ **IMPORTANT** API Keys are not provided by default. In order to enable AI capability, you have to ***BRING YOUR OWN API Key***.
166
  """
167
  gr.Markdown(intro)
168
  with gr.Accordion("=== IMPORTANT: READ ME FIRST ===", open=False):
app/config.py CHANGED
@@ -5,11 +5,11 @@ OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") or ""
5
 
6
  CHEAP_API_BASE = os.getenv("CHEAP_API_BASE") or OPENAI_API_BASE
7
  CHEAP_API_KEY = os.getenv("CHEAP_API_KEY") or OPENAI_API_KEY
8
- CHEAP_MODEL = os.getenv("CHEAP_MODEL") or "gpt-3.5-turbo"
9
 
10
  STRONG_API_BASE = os.getenv("STRONG_API_BASE") or OPENAI_API_BASE
11
  STRONG_API_KEY = os.getenv("STRONG_API_KEY") or OPENAI_API_KEY
12
- STRONG_MODEL = os.getenv("STRONG_MODEL") or "gpt-4-0125-preview"
13
 
14
  IS_SHARE = bool(os.getenv("IS_SHARE")) or False
15
  IS_DEBUG = bool(os.getenv("IS_DEBUG")) or False
 
5
 
6
  CHEAP_API_BASE = os.getenv("CHEAP_API_BASE") or OPENAI_API_BASE
7
  CHEAP_API_KEY = os.getenv("CHEAP_API_KEY") or OPENAI_API_KEY
8
+ CHEAP_MODEL = os.getenv("CHEAP_MODEL") or "gpt-3.5-turbo-0613"
9
 
10
  STRONG_API_BASE = os.getenv("STRONG_API_BASE") or OPENAI_API_BASE
11
  STRONG_API_KEY = os.getenv("STRONG_API_KEY") or OPENAI_API_KEY
12
+ STRONG_MODEL = os.getenv("STRONG_MODEL") or "gpt-4o"
13
 
14
  IS_SHARE = bool(os.getenv("IS_SHARE")) or False
15
  IS_DEBUG = bool(os.getenv("IS_DEBUG")) or False
app/util.py CHANGED
@@ -40,9 +40,12 @@ def is_valid_openai_api_key(api_base: str, api_key: str) -> bool:
40
  headers = {"Authorization": f"Bearer {api_key}"}
41
  test_url = f"{api_base}/models"
42
  response = requests.get(test_url, headers=headers)
43
- if response.status_code != 200:
44
- ic(response.json())
45
- return response.status_code == 200
 
 
 
46
 
47
 
48
  def checkAPI(api_base: str, api_key: str):
 
40
  headers = {"Authorization": f"Bearer {api_key}"}
41
  test_url = f"{api_base}/models"
42
  response = requests.get(test_url, headers=headers)
43
+ if response.status_code in range(200,300):
44
+ try:
45
+ ic(response.json())
46
+ except:
47
+ ic(response.text)
48
+ return response.status_code in range(200,300)
49
 
50
 
51
  def checkAPI(api_base: str, api_key: str):