dmurali commited on
Commit
e02607b
1 Parent(s): 6186cce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +89 -94
app.py CHANGED
@@ -1,95 +1,90 @@
1
- import app_funtions as appfun
2
- import os
3
- import shutil
4
- import glob
5
- import gradio as gr
6
- from pathlib import Path
7
- from datetime import datetime
8
-
9
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
10
-
11
- gr.Markdown("""<h1><center>Resume Processing</center></h1>""")
12
- password_row = gr.Row()
13
- password_text_row = gr.Row(visible=False)
14
- content_row = gr.Row(visible=False)
15
- confirmation_row = gr.Row(visible=False)
16
-
17
- MIL_Password = gr.Textbox(type='password', label="Enter the Password", visible=True)
18
- log_in = gr.Button("Log In", visible=True)
19
- log_in.click(fn=appfun.check_password, inputs=MIL_Password,
20
- outputs=[MIL_Password, log_in, password_text_row, content_row])
21
-
22
- with password_text_row:
23
- gr.Markdown("""<h3><center>Incorrect Password. Access Denied.</center></h3>""")
24
-
25
- with content_row:
26
- with gr.Tab('Resume Input'):
27
- gr.Markdown("""<h3><center>Resumes Input</center></h3>""")
28
- gr.Markdown("""<p><center>Upload or delete any resumes you would like to have the AI use:</center></p>""")
29
- with gr.Row():
30
- with gr.Column():
31
- upload_resume = gr.UploadButton('Upload Resume', file_count="multiple")
32
- with gr.Column():
33
- delete_resume = gr.Button('Delete')
34
-
35
- with gr.Row():
36
-
37
- @gr.render(triggers=[upload_resume.upload, delete_resume.click, log_in.click])
38
- def file_exp():
39
- resume_file_explorer = gr.FileExplorer(
40
- root_dir=os.path.abspath("Resumes"),
41
- label='Resumes',
42
- interactive=True,
43
- elem_id='explorer',
44
- )
45
- upload_resume.upload(fn=appfun.add_resume, inputs=upload_resume)
46
- delete_resume.click(fn=appfun.remove_resumes, inputs=resume_file_explorer)
47
- with gr.Tab('Job Input'):
48
- gr.Markdown("""<h3><center>Job Input</center></h3>""")
49
- gr.Markdown("""<p><center>Upload a document you would like to extract job description from. Supported file types are: .pdf,
50
- .docx, .pptx, .txt.</center></p>""")
51
- upload_file = gr.File()
52
- extract_button = gr.Button('Extract')
53
- extract_completion_message = gr.Markdown("""<p><center></center></p>""")
54
- with gr.Tab('Rank Resumes'):
55
- gr.Markdown("""<h3><center>Rank Resumes</center></h3>""")
56
- gr.Markdown("""<p><center>Choose the job posting of which you would like to get the top 3 resumes for.</center></p>""")
57
- job_select = gr.Dropdown(label='Select Job', choices=appfun.job_names + ['Custom'], allow_custom_value=True)
58
- with gr.Row(visible=False) as job_details:
59
- with gr.Column():
60
- job_name_input = gr.Textbox(label='Job Name', lines=1, interactive=True)
61
- job_description_input = gr.Textbox(label='Job Description', lines=5, interactive=True)
62
- get_resumes = gr.Button('Rank Resumes')
63
- with gr.Row(visible=True) as gpt_response:
64
- best_resumes = gr.Markdown()
65
- with gr.Tab("Chatbot"):
66
- chatbot = gr.Chatbot(avatar_images=("user.jpeg", "gpt.jpg"), height=750)
67
- state = gr.State()
68
- chatbot_textbox = gr.Textbox(label="Input", info="", lines=1,
69
- placeholder="Please process resumes", scale=1,
70
- interactive=False)
71
- chatbot_submit = gr.Button("SEND", interactive=False, scale=1)
72
- chatbot_submit.click(appfun.my_chatbot, inputs=[chatbot_textbox, state],
73
- outputs=[chatbot, state, chatbot_textbox])
74
-
75
-
76
-
77
- job_select.select(fn=appfun.job_selected, inputs=job_select,
78
- outputs=[job_name_input, job_description_input, job_details, best_resumes])
79
- get_resumes.click(appfun.send_to_openai, inputs=[job_name_input, job_description_input],
80
- outputs=[best_resumes, gpt_response, chatbot_textbox, chatbot_submit])
81
- extract_button.click(fn=appfun.extract_jobs, inputs=upload_file, outputs=[extract_completion_message, job_select])
82
-
83
-
84
- if __name__ == '__main__':
85
- # Remove all current resumes from the Resumes folder
86
- files = glob.glob(os.path.abspath('Resumes') + "/*")
87
- for f in files:
88
- os.remove(f)
89
-
90
- # Copy all the defaults resumes to the resume folder
91
- files = glob.glob(os.path.abspath('Default Resumes') + "/*")
92
- for f in files:
93
- shutil.copy(f, os.path.abspath('Resumes'))
94
-
95
  demo.launch()
 
1
+ import app_funtions as appfun
2
+ import os
3
+ import shutil
4
+ import glob
5
+ import gradio as gr
6
+ from pathlib import Path
7
+ from datetime import datetime
8
+
9
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
10
+
11
+ gr.Markdown("""<h1><center>Resume Processing</center></h1>""")
12
+ password_row = gr.Row()
13
+ password_text_row = gr.Row(visible=False)
14
+ content_row = gr.Row(visible=False)
15
+ confirmation_row = gr.Row(visible=False)
16
+
17
+ MIL_Password = gr.Textbox(type='password', label="Enter the Password", visible=True)
18
+ log_in = gr.Button("Log In", visible=True)
19
+ log_in.click(fn=appfun.check_password, inputs=MIL_Password,
20
+ outputs=[MIL_Password, log_in, password_text_row, content_row])
21
+
22
+ with password_text_row:
23
+ gr.Markdown("""<h3><center>Incorrect Password. Access Denied.</center></h3>""")
24
+
25
+ with content_row:
26
+ with gr.Tab('Resume Input'):
27
+ gr.Markdown("""<h3><center>Resumes Input</center></h3>""")
28
+ gr.Markdown("""<p><center>Upload or delete any resumes you would like to have the AI use:</center></p>""")
29
+ with gr.Row():
30
+ with gr.Column():
31
+ upload_resume = gr.UploadButton('Upload Resume', file_count="multiple")
32
+ with gr.Column():
33
+ delete_resume = gr.Button('Delete')
34
+
35
+ with gr.Row():
36
+
37
+ @gr.render(triggers=[upload_resume.upload, delete_resume.click, log_in.click])
38
+ def file_exp():
39
+ resume_file_explorer = gr.FileExplorer(
40
+ root_dir=os.path.abspath("Resumes"),
41
+ label='Resumes',
42
+ interactive=True,
43
+ elem_id='explorer',
44
+ )
45
+ upload_resume.upload(fn=appfun.add_resume, inputs=upload_resume)
46
+ delete_resume.click(fn=appfun.remove_resumes, inputs=resume_file_explorer)
47
+ with gr.Tab('Job Input'):
48
+ gr.Markdown("""<h3><center>Job Input</center></h3>""")
49
+ gr.Markdown("""<p><center>Upload a document you would like to extract job description from. Supported file types are: .pdf,
50
+ .docx, .pptx, .txt.</center></p>""")
51
+ upload_file = gr.File()
52
+ extract_button = gr.Button('Extract')
53
+ extract_completion_message = gr.Markdown("""<p><center></center></p>""")
54
+ with gr.Tab('Rank Resumes'):
55
+ gr.Markdown("""<h3><center>Rank Resumes</center></h3>""")
56
+ gr.Markdown("""<p><center>Choose the job posting of which you would like to get the top 3 resumes for.</center></p>""")
57
+ job_select = gr.Dropdown(label='Select Job', choices=appfun.job_names + ['Custom'], allow_custom_value=True)
58
+ with gr.Row(visible=False) as job_details:
59
+ with gr.Column():
60
+ job_name_input = gr.Textbox(label='Job Name', lines=1, interactive=True)
61
+ job_description_input = gr.Textbox(label='Job Description', lines=5, interactive=True)
62
+ get_resumes = gr.Button('Rank Resumes')
63
+ with gr.Row(visible=True) as gpt_response:
64
+ best_resumes = gr.Markdown()
65
+ with gr.Tab("Chatbot"):
66
+ chatbot = gr.Chatbot(avatar_images=("user.jpeg", "gpt.jpg"), height=750)
67
+ state = gr.State()
68
+ chatbot_textbox = gr.Textbox(label="Input", info="", lines=1,
69
+ placeholder="Please process resumes", scale=1,
70
+ interactive=False)
71
+ chatbot_submit = gr.Button("SEND", interactive=False, scale=1)
72
+ chatbot_submit.click(appfun.my_chatbot, inputs=[chatbot_textbox, state],
73
+ outputs=[chatbot, state, chatbot_textbox])
74
+
75
+
76
+
77
+ job_select.select(fn=appfun.job_selected, inputs=job_select,
78
+ outputs=[job_name_input, job_description_input, job_details, best_resumes])
79
+ get_resumes.click(appfun.send_to_openai, inputs=[job_name_input, job_description_input],
80
+ outputs=[best_resumes, gpt_response, chatbot_textbox, chatbot_submit])
81
+ extract_button.click(fn=appfun.extract_jobs, inputs=upload_file, outputs=[extract_completion_message, job_select])
82
+
83
+
84
+ if __name__ == '__main__':
85
+ # Remove all current resumes from the Resumes folder
86
+ files = glob.glob(os.path.abspath('Resumes') + "/*")
87
+ for f in files:
88
+ os.remove(f)
89
+
 
 
 
 
 
90
  demo.launch()