waloneai commited on
Commit
2c07988
·
verified ·
1 Parent(s): 95d2ae3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -10,6 +10,10 @@ from langchain.llms import OpenAI
10
  from langchain.chains.question_answering import load_qa_chain
11
  from langchain.chat_models import ChatOpenAI
12
 
 
 
 
 
13
  css_style = """
14
  .gradio-container {
15
  font-family: "IBM Plex Mono";
@@ -30,10 +34,7 @@ def run(uploaded_files):
30
  print(all_files)
31
  return all_files
32
 
33
- def createAnswer(files, designation, openaikey):
34
- # Set the OpenAI API key as an environment variable
35
- os.environ['OPENAI_API_KEY'] = openaikey.strip()
36
-
37
  # Initialize the Docs object with the OpenAI API key
38
  docs = Docs(llm='gpt-3.5-turbo')
39
 
@@ -59,13 +60,10 @@ with gr.Blocks(css=css_style) as demo:
59
  This tool is under active development and currently uses many tokens - up to 10,000
60
  for a single query. That is $0.10-0.20 per query, so please be careful!
61
  Porting it to Llama.cpp soon for saved cost.
62
- 1. Enter API Key ([What is that?](https://platform.openai.com/account/api-keys))
63
- 2. Upload your Resumes (Try a few resumes/cv to try < 5)
64
- 3. Provide Designation for which you are hiring
65
  """)
66
 
67
- openaikey = gr.Text(
68
- label='Your OpenAI Api Key', value="")
69
  position = gr.Text(
70
  label='Position/Designation for which you are hiring for', value="")
71
 
@@ -78,7 +76,7 @@ with gr.Blocks(css=css_style) as demo:
78
  ask = gr.Button("Find Top Candidate")
79
  answer = gr.Markdown(label="Result", elem_classes='answerText')
80
  ask.click(fn=createAnswer, inputs=[
81
- uploaded_files, position, openaikey], outputs=[answer])
82
 
83
  demo.queue(concurrency_count=20)
84
  demo.launch(show_error=True)
 
10
  from langchain.chains.question_answering import load_qa_chain
11
  from langchain.chat_models import ChatOpenAI
12
 
13
+ # Set your OpenAI API key here
14
+ OPENAI_API_KEY = 'your_openai_api_key_here'
15
+ os.environ['OPENAI_API_KEY'] = OPENAI_API_KEY
16
+
17
  css_style = """
18
  .gradio-container {
19
  font-family: "IBM Plex Mono";
 
34
  print(all_files)
35
  return all_files
36
 
37
+ def createAnswer(files, designation):
 
 
 
38
  # Initialize the Docs object with the OpenAI API key
39
  docs = Docs(llm='gpt-3.5-turbo')
40
 
 
60
  This tool is under active development and currently uses many tokens - up to 10,000
61
  for a single query. That is $0.10-0.20 per query, so please be careful!
62
  Porting it to Llama.cpp soon for saved cost.
63
+ 1. Upload your Resumes (Try a few resumes/cv to try < 5)
64
+ 2. Provide Designation for which you are hiring
 
65
  """)
66
 
 
 
67
  position = gr.Text(
68
  label='Position/Designation for which you are hiring for', value="")
69
 
 
76
  ask = gr.Button("Find Top Candidate")
77
  answer = gr.Markdown(label="Result", elem_classes='answerText')
78
  ask.click(fn=createAnswer, inputs=[
79
+ uploaded_files, position], outputs=[answer])
80
 
81
  demo.queue(concurrency_count=20)
82
  demo.launch(show_error=True)