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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
-
iface.launch()
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# coding: utf-8
|
3 |
+
|
4 |
+
# In[1]:
|
5 |
+
|
6 |
+
|
7 |
+
import os
|
8 |
+
import openai
|
9 |
+
import jinja2
|
10 |
+
import pdfkit
|
11 |
+
import random
|
12 |
+
import re
|
13 |
+
import sys
|
14 |
+
import numpy as np
|
15 |
import gradio as gr
|
16 |
+
from zipfile import ZipFile
|
17 |
+
from langchain.llms import OpenAI
|
18 |
+
from langchain.chat_models import ChatOpenAI
|
19 |
+
from langchain.output_parsers import ResponseSchema,PydanticOutputParser,StructuredOutputParser
|
20 |
+
from langchain import PromptTemplate
|
21 |
+
from langchain.prompts import PromptTemplate, ChatPromptTemplate, HumanMessagePromptTemplate
|
22 |
+
from langchain.output_parsers import CommaSeparatedListOutputParser
|
23 |
+
from pydantic import BaseModel, Field, validator
|
24 |
+
from typing import List
|
25 |
+
from langchain.text_splitter import CharacterTextSplitter,RecursiveCharacterTextSplitter
|
26 |
+
|
27 |
+
output_parser = CommaSeparatedListOutputParser()
|
28 |
+
|
29 |
+
|
30 |
+
from datetime import datetime
|
31 |
+
|
32 |
+
|
33 |
+
# In[2]:
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
c_splitter = CharacterTextSplitter(chunk_size = 450,chunk_overlap = 0,separator = ' ')
|
38 |
+
r_splitter = RecursiveCharacterTextSplitter(chunk_size = 80,chunk_overlap = 0,separators = ["\n\n"])
|
39 |
+
|
40 |
+
|
41 |
+
# In[3]:
|
42 |
+
|
43 |
+
|
44 |
+
output_parser = CommaSeparatedListOutputParser()
|
45 |
+
format_instructions = output_parser.get_format_instructions()
|
46 |
+
|
47 |
+
|
48 |
+
# In[12]:
|
49 |
+
|
50 |
+
|
51 |
+
#定义常用函数
|
52 |
+
|
53 |
+
#公司生成函数
|
54 |
+
def company_cr(target_company,language,key):
|
55 |
+
tar_com_prompt = """ List 6 competitors' name of {company} in {lang}.\n{format_instructions}
|
56 |
+
"""
|
57 |
+
chat_0_3 = ChatOpenAI(temperature = 0.0,openai_api_key = key)
|
58 |
+
pTem_tar_c = ChatPromptTemplate.from_template(tar_com_prompt)
|
59 |
+
prompt_c = pTem_tar_c.format_messages(company = target_company,lang = language,format_instructions = format_instructions)
|
60 |
+
print(prompt_c)
|
61 |
+
mock_exp_company = chat_0_3(prompt_c)
|
62 |
+
print(mock_exp_company)
|
63 |
+
mock_exp_company_fin = mock_exp_company.content.split(',')
|
64 |
+
return mock_exp_company_fin
|
65 |
+
|
66 |
+
#职位生成函数
|
67 |
+
def job_cr(target_job,language,key):
|
68 |
+
tar_job_prompt = """ List 2 similar names of this {job} in {lang}.\n{format_instructions}
|
69 |
+
"""
|
70 |
+
chat_0_3 = ChatOpenAI(temperature = 0.0,openai_api_key = key)
|
71 |
+
pTem_tar_j = ChatPromptTemplate.from_template(tar_job_prompt)
|
72 |
+
prompt_j = pTem_tar_j.format_messages(job = target_job,lang = language,format_instructions = format_instructions)
|
73 |
+
mock_exp_job = chat_0_3(prompt_j)
|
74 |
+
print(mock_exp_job)
|
75 |
+
mock_exp_job_fin = mock_exp_job.content.split(',')
|
76 |
+
print(mock_exp_job_fin)
|
77 |
+
return mock_exp_job_fin
|
78 |
+
|
79 |
+
#工作一级技能函数
|
80 |
+
def skill_pri_cr(job_req,key):
|
81 |
+
tar_skill_pri_prompt = """ Assume you are the recruiter, read the {job_requirement}, then list 20 tech terms you want to see on candidates resume.\n{format_instructions}
|
82 |
+
"""
|
83 |
+
chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
|
84 |
+
pTem_tar_skill = ChatPromptTemplate.from_template(tar_skill_pri_prompt)
|
85 |
+
prompt_skill = pTem_tar_skill.format_messages(job_requirement = job_req,format_instructions = format_instructions)
|
86 |
+
mock_skill_pri = chat_0_4(prompt_skill)
|
87 |
+
print(mock_skill_pri)
|
88 |
+
mock_skill_pri_fin = mock_skill_pri.content.split(',')
|
89 |
+
print(mock_skill_pri_fin)
|
90 |
+
return mock_skill_pri_fin
|
91 |
+
|
92 |
+
|
93 |
+
#工作二级技能函数
|
94 |
+
def skill_sec_cr(skill_pri,language,key):
|
95 |
+
tar_skill_sec_prompt = """ Assume you are the recruiter, read the skill sets in {skill_pri}, list 5 related tech terms for each skill set you want to see on candidates resume in {lang}.\n{format_instructions}
|
96 |
+
"""
|
97 |
+
#chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
|
98 |
+
chat_0_3 = ChatOpenAI(temperature = 0.0,openai_api_key = key)
|
99 |
+
pTem_tar_skill_sec = ChatPromptTemplate.from_template(tar_skill_sec_prompt)
|
100 |
+
prompt_skill_sec = pTem_tar_skill_sec.format_messages(skill_pri = skill_pri,lang = language,format_instructions = format_instructions)
|
101 |
+
|
102 |
+
mock_skill_sec = chat_0_3(prompt_skill_sec)
|
103 |
+
#mock_skill_sec = chat_0_4(prompt_skill_sec)
|
104 |
+
print(mock_skill_sec)
|
105 |
+
mock_skill_sec_fin = mock_skill_sec.content.split(',')
|
106 |
+
print(mock_skill_sec_fin)
|
107 |
+
return mock_skill_sec_fin
|
108 |
+
|
109 |
+
#社团生成函数
|
110 |
+
def soc_cr(target_job,language,key):
|
111 |
+
tar_soc_prompt = """ If a student want to become a {job_name} after graduation, list 5 possible school clubs or competitions the student wants to join in {lang}.\n{format_instructions}
|
112 |
+
"""
|
113 |
+
chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
|
114 |
+
pTem_tar_soc = ChatPromptTemplate.from_template(tar_soc_prompt)
|
115 |
+
prompt_soc = pTem_tar_soc.format_messages(job_name = target_job,lang = language,format_instructions = format_instructions)
|
116 |
+
|
117 |
+
mock_exp_soc = chat_0_4(prompt_soc)
|
118 |
+
print(mock_exp_soc)
|
119 |
+
mock_exp_soc_fin = mock_exp_soc.content.split(',')
|
120 |
+
print(mock_exp_soc_fin)
|
121 |
+
|
122 |
+
return mock_exp_soc_fin
|
123 |
+
|
124 |
+
|
125 |
+
#工作简历生成函数
|
126 |
+
def work_exp(mock_company,mock_title,mock_skill,language,key):
|
127 |
+
working_exp_prompt = """ Write the working experience in {lang}. Considering my working experience in {company} as a {title}, and I am good at {skill_sec}, write a part of resume for me. A good resume reorganizes the skill set in 3 to 4 examples. Each example must include 60 to 80 words. A good resume must not use pronouns. Each example must have detail numbers to describe result. List each example in a new line without serial numbers. """
|
128 |
+
chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
|
129 |
+
|
130 |
+
pTem_tar_working_exp = ChatPromptTemplate.from_template(working_exp_prompt)
|
131 |
+
prompt_working_exp = pTem_tar_working_exp.format_messages(company = mock_company,lang = language,title = mock_title,skill_sec = mock_skill)
|
132 |
+
|
133 |
+
|
134 |
+
mock_working_exp = chat_0_4(prompt_working_exp)
|
135 |
+
print(mock_working_exp)
|
136 |
+
mock_working_exp_fin = r_splitter.split_text(mock_working_exp.content)
|
137 |
+
print(mock_working_exp_fin)
|
138 |
+
result = [mock_working_exp_fin[0],mock_working_exp_fin[1],mock_working_exp_fin[2]]
|
139 |
+
|
140 |
+
|
141 |
+
print(mock_working_exp_fin[3])
|
142 |
+
print(result)
|
143 |
+
return (mock_working_exp_fin[0],mock_working_exp_fin[1],mock_working_exp_fin[2])
|
144 |
+
|
145 |
+
|
146 |
+
def club_exp(mock_soc,mock_skill_soc,language,key):
|
147 |
+
club_exp_prompt = """ Write the school experience in {lang}. Considering my school experience in {club}, and I am good at {skill_sec_club}, write a part of resume for me. A good resume reorganizes the skill set in 3 examples. Each example must include 60 to 80 words. A good resume must not use pronouns. Each example must have detail numbers to describe result. List each example in a new line without serial numbers. """
|
148 |
+
chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
|
149 |
+
n_range = range(0,80)
|
150 |
+
rand_value = random.sample(n_range,4)
|
151 |
+
print(rand_value)
|
152 |
+
|
153 |
+
mock_skill_soc_fin = np.array(mock_skill_soc)[rand_value]
|
154 |
+
|
155 |
+
pTem_tar_club_exp = ChatPromptTemplate.from_template(club_exp_prompt)
|
156 |
+
prompt_club_exp = pTem_tar_club_exp.format_messages(club = mock_soc,lang = language,skill_sec_club = mock_skill_soc_fin)
|
157 |
+
|
158 |
+
print(pTem_tar_club_exp)
|
159 |
+
print(prompt_club_exp)
|
160 |
+
|
161 |
+
|
162 |
+
mock_club_exp = chat_0_4(prompt_club_exp)
|
163 |
+
print(mock_club_exp)
|
164 |
+
|
165 |
+
mock_club_exp_fin = r_splitter.split_text(mock_club_exp.content)
|
166 |
+
print(mock_club_exp_fin)
|
167 |
+
|
168 |
+
print(mock_club_exp_fin[0])
|
169 |
+
|
170 |
+
return mock_club_exp_fin
|
171 |
+
|
172 |
+
|
173 |
+
#定义履历生成函数
|
174 |
+
def skill_info(job_req,language,key):
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
# 生成Skillset
|
179 |
+
mock_skill_pri = skill_pri_cr(job_req,key)
|
180 |
+
|
181 |
+
# 生成2级Skillset
|
182 |
+
mock_skill_sec = skill_sec_cr(mock_skill_pri,language,key)
|
183 |
+
|
184 |
+
|
185 |
+
return mock_skill_sec
|
186 |
+
|
187 |
+
|
188 |
+
|
189 |
+
|
190 |
+
#简历排版函数
|
191 |
+
def resume(name,mobile,email,Gra_beg,Gra_end,Gra_sch,Gra_maj,underGra_beg,underGra_end,underGra_sch,underGra_maj,exp_one_beg,exp_one_end,exp_one_com,exp_one_title,exp_one_1,exp_one_2,exp_one_3,exp_two_beg,exp_two_end,exp_two_com,exp_two_title,exp_two_1,exp_two_2,exp_two_3,exp_three_beg,exp_three_end,exp_three_com,exp_three_title,exp_three_1,exp_three_2,exp_three_3):
|
192 |
+
|
193 |
+
# 生成html和pdf
|
194 |
+
|
195 |
+
pdfkit_options = {'encoding': 'UTF-8'}
|
196 |
+
body = f"""
|
197 |
+
|
198 |
+
<main role="main">
|
199 |
+
<div class="page"><!-- 1. Header -->
|
200 |
+
<h1 style="text-align: center;">{name}</h1>
|
201 |
+
<p style="text-align: center;">手机:{mobile} 邮箱:{email}</p>
|
202 |
+
<hr /><!-- 2a. Resume Content -->
|
203 |
+
<section class="resume_content">
|
204 |
+
<article>
|
205 |
+
<h3>教育经历</h3>
|
206 |
+
<div style="float: left;">{Gra_beg}-{Gra_end} <strong>{Gra_sch}</strong></div>
|
207 |
+
<div style="float: right;">{Gra_maj} <strong>本科</strong></div>
|
208 |
+
<br />
|
209 |
+
<div style="float: left;">{underGra_beg}-{underGra_end} <strong>{underGra_sch}</strong></div>
|
210 |
+
<div style="float: right;">{underGra_maj} <strong>本科</strong></div>
|
211 |
+
<br /><hr />
|
212 |
+
<h3>工作经历</h3>
|
213 |
+
<section>
|
214 |
+
<div style="float: left;">{exp_one_beg}-{exp_one_end} <strong>{exp_one_com}</strong></div>
|
215 |
+
<div style="float: right;"><strong>{exp_one_title}</strong></div>
|
216 |
+
<br />
|
217 |
+
<ul>
|
218 |
+
<p><li>{exp_one_1}</li></p>
|
219 |
+
<p><li>{exp_one_2}</li></p>
|
220 |
+
<p><li>{exp_one_3}</li></p>
|
221 |
+
</ul>
|
222 |
+
<div style="float: left;">{exp_two_beg}-{exp_two_end} <strong>{exp_two_com}</strong></div>
|
223 |
+
<div style="float: right;"><strong>{exp_two_title}</strong></div>
|
224 |
+
<br />
|
225 |
+
<ul>
|
226 |
+
<p><li>{exp_two_1}</li></p>
|
227 |
+
<p><li>{exp_two_2}</li></p>
|
228 |
+
<p><li>{exp_two_3}</li></p>
|
229 |
+
</ul>
|
230 |
+
<div style="float: left;">{exp_three_beg}-{exp_three_end} <strong>{exp_three_com}</strong></div>
|
231 |
+
<div style="float: right;"><strong>{exp_three_title}</strong></div>
|
232 |
+
<br />
|
233 |
+
<ul>
|
234 |
+
<p><li>{exp_three_1}</li></p>
|
235 |
+
<p><li>{exp_three_2}</li></p>
|
236 |
+
<p><li>{exp_three_3}</li></p>
|
237 |
+
</ul>
|
238 |
+
</article>
|
239 |
+
</section>
|
240 |
+
</div>
|
241 |
+
</main>
|
242 |
+
|
243 |
+
|
244 |
+
"""
|
245 |
+
|
246 |
+
|
247 |
+
pdfkit.from_string(body, 'out.pdf',options=pdfkit_options) #with --page-size=Legal and --orientation=Landscape
|
248 |
+
|
249 |
+
|
250 |
+
|
251 |
+
return body
|
252 |
+
|
253 |
+
|
254 |
+
# In[ ]:
|
255 |
+
|
256 |
+
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
# In[13]:
|
261 |
+
|
262 |
+
|
263 |
+
# Json输入,Dropdown更新函数
|
264 |
+
def Dropdown_list(list_in):
|
265 |
+
new_options = list_in
|
266 |
+
return gr.Dropdown.update(choices=new_options)
|
267 |
+
# List内Json增加函数,输入Json,输出list
|
268 |
+
def Add_list(list_in,list_add):
|
269 |
+
list_out = list_in + list_add.split(",")
|
270 |
+
return list_out
|
271 |
+
# Json输入,Textbox默认值更新
|
272 |
+
def Textbox_value(list_in,num):
|
273 |
+
num = int(num)
|
274 |
+
new_value = list_in[num]
|
275 |
+
return gr.Textbox.update(value = new_value)
|
276 |
+
#Json输入,Dropdown默认值随机输出
|
277 |
+
def Dropdown_value_rand(list_in,num):
|
278 |
+
num = int(num)
|
279 |
+
n_range = range(0,80)
|
280 |
+
rand_value = random.sample(n_range,num)
|
281 |
+
list_out = np.array(list_in)[rand_value]
|
282 |
+
list_out = list_out.tolist()
|
283 |
+
return list_out
|
284 |
+
#Button触发其他Button的显示
|
285 |
+
def Button_visible():
|
286 |
+
return gr.Button.update(visible = True)
|
287 |
+
#文本框提交输出文本值
|
288 |
+
def Textbox_value_os(str_in):
|
289 |
+
return gr.Textbox.update(value = str_in)
|
290 |
+
|
291 |
+
|
292 |
+
|
293 |
+
|
294 |
+
options = ['Select a company']
|
295 |
+
|
296 |
+
with gr.Blocks() as demo:
|
297 |
+
with gr.Row():
|
298 |
+
with gr.Column():
|
299 |
+
#openai_gpt4_key = gr.Textbox(label="OpenAI GPT4 Key", value="", type="password", placeholder="sk..", info = "You have to provide your own GPT4 keys for this app to function properly",)
|
300 |
+
#key = str(txt_openAI_key.change(Textbox_value_submit, inputs =txt_openAI_key))
|
301 |
+
#print(key)
|
302 |
+
txt_key = gr.Textbox(value = "sk...",label = "key")
|
303 |
+
#print(openai_gpt4_key)
|
304 |
+
txt_key.change(Textbox_value_os,inputs = txt_key)
|
305 |
+
txt_tarcom_in = gr.Textbox(label = "Target Company",info = "e.g. Amazon")
|
306 |
+
txt_tarjob_in = gr.Textbox(label = "Target Job",info = "e.g. Data Analyst")
|
307 |
+
txt_jd_in = gr.Textbox(label = "Job Responsibility",info = "e.g. - Write high quality distributed system software- Build production quality and large scale deployment of applications related to NLP and ML- Use software engineering best practices to ensure a high standard of quality for all team deliverables- Design, implement, test, deploy and maintain innovative software solutions to transform service performance, stability, cost and security- Help drive business decisions with your technical input- Work in an agile, startup-like development environment, where you're always working on the most important stuff")
|
308 |
+
txt_lang_in = gr.Dropdown(["Chinese", "English"],label="Language", info="Choose the language of your resume")
|
309 |
+
btn_resume_info = gr.Button(value="Analyze Target Job")
|
310 |
+
btn_exp_gen = gr.Button(value = "Generate Experience",visible = False)
|
311 |
+
btn_resume_gen = gr.Button(value = "Generate Resume",visible = False)
|
312 |
+
with gr.Row():
|
313 |
+
name = gr.Textbox(label = "Name")
|
314 |
+
mobile = gr.Textbox(label = "Mobile")
|
315 |
+
email = gr.Textbox(label = "Email")
|
316 |
+
with gr.Row():
|
317 |
+
Gra_beg = gr.Textbox(label = "Graduate School Beginning Year")
|
318 |
+
Gra_end = gr.Textbox(label = "Graduate School End Year")
|
319 |
+
Gra_sch = gr.Textbox(label = "Graduate School Name")
|
320 |
+
Gra_maj = gr.Textbox(label = "Graduate School Major")
|
321 |
+
with gr.Row():
|
322 |
+
underGra_beg = gr.Textbox(label = "Undergraduate School Beginning Year")
|
323 |
+
underGra_end = gr.Textbox(label = "Undergraduate School End Year")
|
324 |
+
underGra_sch = gr.Textbox(label = "Undergraduate School Name")
|
325 |
+
underGra_maj = gr.Textbox(label = "Undergraduate School Major")
|
326 |
+
btn_resume_pre = gr.Button(value = "Preview Resume",visible = False)
|
327 |
+
js_com_out = gr.JSON(label = "Company output")
|
328 |
+
js_title_out = gr.JSON(label = "Proper Title",visible = False)
|
329 |
+
js_sec_skill_out = gr.JSON(label = "Output",visible = False)
|
330 |
+
js_club_out = gr.JSON(label = "Output",visible = False)
|
331 |
+
#dd_com_in = gr.Dropdown(options)
|
332 |
+
|
333 |
+
btn_resume_info.click(company_cr, inputs = [txt_tarcom_in, txt_lang_in, txt_key], outputs = js_com_out)
|
334 |
+
btn_resume_info.click(job_cr, inputs = [txt_tarjob_in, txt_lang_in,txt_key], outputs = js_title_out)
|
335 |
+
btn_resume_info.click(skill_info, inputs = [txt_jd_in, txt_lang_in,txt_key], outputs = js_sec_skill_out)
|
336 |
+
|
337 |
+
|
338 |
+
btn_resume_info.click(Button_visible,outputs = btn_exp_gen,queue = True)
|
339 |
+
|
340 |
+
|
341 |
+
|
342 |
+
|
343 |
+
with gr.Row():
|
344 |
+
exp_com_one = gr.Textbox(value = options,label="Company Name")
|
345 |
+
exp_title_one = gr.Textbox(value = options,label="Title Name")
|
346 |
+
time_beg_one = gr.Textbox(value = '2016')
|
347 |
+
time_end_one = gr.Textbox(value = '2017')
|
348 |
+
exp_skill_one = gr.Dropdown(value = options, label = "Skill",multiselect = True)
|
349 |
+
num_one = gr.Textbox("0",visible = False)
|
350 |
+
num_two = gr.Textbox("1",visible = False)
|
351 |
+
num_three = gr.Textbox("2",visible = False)
|
352 |
+
num_rand = gr.Textbox("10",visible = False)
|
353 |
+
btn_exp_gen.click(Textbox_value,inputs = [js_com_out,num_one],outputs = exp_com_one)
|
354 |
+
btn_exp_gen.click(Textbox_value,inputs = [js_title_out,num_one],outputs = exp_title_one)
|
355 |
+
btn_exp_gen.click(Dropdown_value_rand,inputs = [js_sec_skill_out,num_rand],outputs = exp_skill_one)
|
356 |
+
|
357 |
+
|
358 |
+
exp_txt_one_1 = gr.Textbox(value = options,interactive = True)
|
359 |
+
exp_txt_one_2 = gr.Textbox(value = options,interactive = True)
|
360 |
+
exp_txt_one_3 = gr.Textbox(value = options,interactive = True)
|
361 |
+
btn_work_exp_one = gr.Button(value = "Update Working Experience One")
|
362 |
+
|
363 |
+
btn_work_exp_one.click(work_exp, inputs=[exp_com_one,exp_title_one,exp_skill_one,txt_lang_in,txt_key],outputs = [exp_txt_one_1,exp_txt_one_2,exp_txt_one_3])
|
364 |
+
|
365 |
+
|
366 |
+
|
367 |
+
with gr.Row():
|
368 |
+
exp_com_two = gr.Textbox(value = options,label="Company Name")
|
369 |
+
exp_title_two = gr.Textbox(value = options,label="Title Name")
|
370 |
+
time_beg_two = gr.Textbox(value = '2016')
|
371 |
+
time_end_two = gr.Textbox(value = '2017')
|
372 |
+
exp_skill_two = gr.Dropdown(value = options, label = "Skill",multiselect = True)
|
373 |
+
btn_exp_gen.click(Textbox_value,inputs = [js_com_out,num_two],outputs = exp_com_two)
|
374 |
+
btn_exp_gen.click(Textbox_value,inputs = [js_title_out,num_two],outputs = exp_title_two)
|
375 |
+
btn_exp_gen.click(Dropdown_value_rand,inputs = [js_sec_skill_out,num_rand],outputs = exp_skill_two)
|
376 |
+
|
377 |
+
exp_txt_two_1 = gr.Textbox(value = options,interactive = True)
|
378 |
+
exp_txt_two_2 = gr.Textbox(value = options,interactive = True)
|
379 |
+
exp_txt_two_3 = gr.Textbox(value = options,interactive = True)
|
380 |
+
btn_work_exp_two = gr.Button(value = "Update Working Experience Two")
|
381 |
+
|
382 |
+
btn_work_exp_two.click(work_exp, inputs=[exp_com_two,exp_title_two,exp_skill_two,txt_lang_in,txt_key],outputs = [exp_txt_two_1,exp_txt_two_2,exp_txt_two_3])
|
383 |
+
|
384 |
+
|
385 |
+
|
386 |
+
|
387 |
+
|
388 |
+
with gr.Row():
|
389 |
+
exp_com_three = gr.Textbox(value = options,label="Company Name")
|
390 |
+
exp_title_three = gr.Textbox(value = options,label="Title Name")
|
391 |
+
time_beg_three = gr.Textbox(value = '2016')
|
392 |
+
time_end_three = gr.Textbox(value = '2017')
|
393 |
+
exp_skill_three = gr.Dropdown(value = options, label = "Skill",multiselect = True)
|
394 |
+
btn_exp_gen.click(Textbox_value,inputs = [js_com_out,num_three],outputs = exp_com_three)
|
395 |
+
btn_exp_gen.click(Textbox_value,inputs = [js_title_out,num_one],outputs = exp_title_three)
|
396 |
+
btn_exp_gen.click(Dropdown_value_rand,inputs = [js_sec_skill_out,num_rand],outputs = exp_skill_three)
|
397 |
+
|
398 |
+
exp_txt_three_1 = gr.Textbox(value = options,interactive = True)
|
399 |
+
exp_txt_three_2 = gr.Textbox(value = options,interactive = True)
|
400 |
+
exp_txt_three_3 = gr.Textbox(value = options,interactive = True)
|
401 |
+
btn_work_exp_three = gr.Button(value = "Update Working Experience Three")
|
402 |
+
|
403 |
+
btn_work_exp_three.click(work_exp, inputs=[exp_com_three,exp_title_three,exp_skill_three,txt_lang_in,txt_key],outputs = [exp_txt_three_1,exp_txt_three_2,exp_txt_three_3])
|
404 |
+
|
405 |
+
|
406 |
+
|
407 |
+
btn_exp_gen.click(Button_visible,outputs = btn_resume_gen)
|
408 |
+
|
409 |
+
btn_resume_gen.click(work_exp, inputs=[exp_com_one,exp_title_one,exp_skill_one,txt_lang_in,txt_key],outputs = [exp_txt_one_1,exp_txt_one_2,exp_txt_one_3])
|
410 |
+
btn_resume_gen.click(work_exp, inputs=[exp_com_two,exp_title_two,exp_skill_two,txt_lang_in,txt_key],outputs = [exp_txt_two_1,exp_txt_two_2,exp_txt_two_3])
|
411 |
+
btn_resume_gen.click(work_exp, inputs=[exp_com_three,exp_title_three,exp_skill_three,txt_lang_in,txt_key],outputs = [exp_txt_three_1,exp_txt_three_2,exp_txt_three_3])
|
412 |
+
btn_resume_gen.click(Button_visible,outputs = btn_resume_pre)
|
413 |
+
|
414 |
+
webpage = gr.HTML()
|
415 |
+
|
416 |
+
btn_resume_pre.click(resume,inputs = [name,mobile,email,Gra_beg,Gra_end,Gra_sch,Gra_maj,underGra_beg,underGra_end,underGra_sch,underGra_maj,time_beg_one,time_end_one,exp_com_one,exp_title_one,exp_txt_one_1,exp_txt_one_2,exp_txt_one_3,time_beg_two,time_end_two,exp_com_two,exp_title_two,exp_txt_two_1,exp_txt_two_2,exp_txt_two_3,time_beg_three,time_end_three,exp_com_three,exp_title_three,exp_txt_three_1,exp_txt_three_2,exp_txt_three_3],outputs = webpage)
|
417 |
+
|
418 |
+
|
419 |
+
if __name__ == "__main__":
|
420 |
+
demo.launch(enable_queue = True)
|
421 |
+
|
422 |
+
|
423 |
+
# In[6]:
|
424 |
+
|
425 |
+
|
426 |
+
|
427 |
+
|
428 |
+
|
429 |
+
# In[31]:
|
430 |
+
|
431 |
+
|
432 |
+
|
433 |
+
|
434 |
+
|
435 |
+
# In[ ]:
|
436 |
+
|
437 |
+
|
438 |
+
|
439 |
+
|
440 |
+
|
441 |
+
# In[ ]:
|
442 |
+
|
443 |
+
|
444 |
+
|
445 |
+
|
446 |
+
|
447 |
+
# In[ ]:
|
448 |
+
|
449 |
+
|
450 |
+
|
451 |
+
|
452 |
+
|
453 |
+
# In[ ]:
|
454 |
+
|
455 |
+
|
456 |
+
|
457 |
+
|
458 |
+
|
459 |
+
# In[ ]:
|
460 |
+
|
461 |
+
|
462 |
+
|
463 |
+
|
464 |
+
|
465 |
+
# In[ ]:
|
466 |
+
|
467 |
+
|
468 |
+
|
469 |
+
|
470 |
+
|
471 |
+
# In[ ]:
|
472 |
+
|
473 |
+
|
474 |
+
|
475 |
+
|
476 |
+
|
477 |
+
# In[ ]:
|
478 |
+
|
479 |
+
|
480 |
+
|
481 |
+
|
482 |
+
|
483 |
+
# In[50]:
|
484 |
+
|
485 |
+
|
486 |
+
|
487 |
+
|
488 |
+
|
489 |
+
# In[ ]:
|
490 |
+
|
491 |
+
|
492 |
+
|
493 |
+
|
494 |
+
|
495 |
+
# In[ ]:
|
496 |
+
|
497 |
+
|
498 |
+
|
499 |
+
|
500 |
+
|
501 |
+
# In[ ]:
|
502 |
+
|
503 |
+
|
504 |
+
|
505 |
+
|
506 |
+
|
507 |
+
# In[ ]:
|
508 |
+
|
509 |
+
|
510 |
+
|
511 |
+
|
512 |
+
|
513 |
+
# In[ ]:
|
514 |
+
|
515 |
+
|
516 |
+
|
517 |
+
|
518 |
+
|
519 |
+
# In[ ]:
|
520 |
+
|
521 |
+
|
522 |
+
|
523 |
+
|
524 |
+
|
525 |
+
# In[ ]:
|
526 |
+
|
527 |
+
|
528 |
+
|
529 |
+
|
530 |
+
|
531 |
+
# In[ ]:
|
532 |
+
|
533 |
+
|
534 |
+
|
535 |
+
|
536 |
+
|
537 |
+
# In[ ]:
|
538 |
+
|
539 |
+
|
540 |
+
|
541 |
+
|
542 |
+
|
543 |
+
# In[ ]:
|
544 |
+
|
545 |
+
|
546 |
+
|
547 |
+
|
548 |
+
|
549 |
+
# In[ ]:
|
550 |
+
|
551 |
+
|
552 |
+
|
553 |
+
|
554 |
+
|
555 |
+
# In[ ]:
|
556 |
+
|
557 |
+
|
558 |
+
|
559 |
+
|
560 |
+
|
561 |
+
# In[ ]:
|
562 |
+
|
563 |
+
|
564 |
+
|
565 |
+
|
566 |
+
|
567 |
+
# In[ ]:
|
568 |
+
|
569 |
+
|
570 |
+
|
571 |
+
|
572 |
+
|
573 |
+
# In[ ]:
|
574 |
+
|
575 |
+
|
576 |
+
|
577 |
+
|
578 |
+
|
579 |
+
# In[ ]:
|
580 |
+
|
581 |
+
|
582 |
+
|
583 |
+
|
584 |
+
|
585 |
+
# In[ ]:
|
586 |
+
|
587 |
+
|
588 |
+
|
589 |
+
|
590 |
+
|
591 |
+
# In[ ]:
|
592 |
+
|
593 |
+
|
594 |
+
|
595 |
+
|
596 |
+
|
597 |
+
# In[ ]:
|
598 |
+
|
599 |
+
|
600 |
+
|
601 |
+
|
602 |
+
|
603 |
+
# In[ ]:
|
604 |
+
|
605 |
+
|
606 |
+
|
607 |
+
|
608 |
+
|
609 |
+
# In[ ]:
|
610 |
+
|
611 |
+
|
612 |
+
|
613 |
+
|
614 |
+
|
615 |
+
# In[ ]:
|
616 |
+
|
617 |
+
|
618 |
+
|
619 |
+
|
620 |
+
|
621 |
+
# In[ ]:
|
622 |
+
|
623 |
+
|
624 |
|
|
|
|
|
625 |
|
|
|
|