File size: 39,361 Bytes
b113387 a477f51 646de19 a477f51 7f1f944 b113387 f680527 a0821bc 22e2027 b113387 05442aa 0821ad7 b113387 a477f51 870745a b113387 7f1f944 c0c415c b113387 7f1f944 b113387 7f1f944 b113387 7f1f944 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 b8738a2 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 a0821bc b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 dd3202d b113387 f680527 b113387 7f1f944 b113387 b8738a2 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 7f1f944 f680527 b113387 f680527 b113387 f680527 b8738a2 f680527 b113387 f680527 b8738a2 b113387 f680527 b113387 f680527 b8738a2 b113387 f680527 b8738a2 b113387 f680527 b113387 f680527 b8738a2 b113387 f680527 b8738a2 f680527 b113387 f680527 b113387 f680527 b113387 f680527 b113387 f680527 7f1f944 f680527 7f1f944 f680527 b113387 f680527 b113387 05442aa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
#pt-get install wkhtmltopdf
# In[60]:
import os
import jinja2
#import openai
import pdfkit
#import random
#import re
#import sys
import numpy as np
import gradio as gr
#from zipfile import ZipFile
from langchain.llms import OpenAI
from langchain.chat_models import ChatOpenAI
from langchain.output_parsers import ResponseSchema,PydanticOutputParser,StructuredOutputParser
from langchain import PromptTemplate
from langchain.prompts import PromptTemplate, ChatPromptTemplate, HumanMessagePromptTemplate
from langchain.output_parsers import CommaSeparatedListOutputParser
from pydantic import BaseModel, Field, validator
from typing import List
from langchain.text_splitter import CharacterTextSplitter,RecursiveCharacterTextSplitter
output_parser = CommaSeparatedListOutputParser()
# Set the path to wkhtmltopdf executable file
#config = pdfkit.configuration(wkhtmltopdf='/home/user/.local/lib/python3.10/site-packages')
from datetime import datetime
# In[61]:
c_splitter = CharacterTextSplitter(chunk_size = 450,chunk_overlap = 0,separator = ' ')
r_splitter = RecursiveCharacterTextSplitter(chunk_size = 80,chunk_overlap = 0,separators = ["\n\n"])
# In[62]:
output_parser = CommaSeparatedListOutputParser()
format_instructions = output_parser.get_format_instructions()
# In[63]:
#定义常用函数
#公司生成函数
def company_cr(target_company,language,key):
tar_com_prompt = """ List 6 competitors' name of {company} in {lang}.\n{format_instructions}
"""
chat_0_3 = ChatOpenAI(temperature = 0.0,openai_api_key = key)
pTem_tar_c = ChatPromptTemplate.from_template(tar_com_prompt)
prompt_c = pTem_tar_c.format_messages(company = target_company,lang = language,format_instructions = format_instructions)
#print(prompt_c)
mock_exp_company = chat_0_3(prompt_c)
#print(mock_exp_company)
mock_exp_company_fin = mock_exp_company.content.split(',')
return mock_exp_company_fin
#职位生成函数
def job_cr(target_job,language,key):
tar_job_prompt = """ List 2 similar names of this {job} in {lang}.\n{format_instructions}
"""
chat_0_3 = ChatOpenAI(temperature = 0.0,openai_api_key = key)
pTem_tar_j = ChatPromptTemplate.from_template(tar_job_prompt)
prompt_j = pTem_tar_j.format_messages(job = target_job,lang = language,format_instructions = format_instructions)
mock_exp_job = chat_0_3(prompt_j)
#print(mock_exp_job)
mock_exp_job_fin = mock_exp_job.content.split(',')
#print(mock_exp_job_fin)
return mock_exp_job_fin
#工作一级技能函数
def skill_pri_cr(job_req,key):
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}
"""
chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
pTem_tar_skill = ChatPromptTemplate.from_template(tar_skill_pri_prompt)
prompt_skill = pTem_tar_skill.format_messages(job_requirement = job_req,format_instructions = format_instructions)
mock_skill_pri = chat_0_4(prompt_skill)
#print(mock_skill_pri)
mock_skill_pri_fin = mock_skill_pri.content.split(',')
#print(mock_skill_pri_fin)
return mock_skill_pri_fin
#工作二级技能函数
def skill_sec_cr(skill_pri,language,key):
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}
"""
chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
#chat_0_3 = ChatOpenAI(temperature = 0.0,openai_api_key = key)
pTem_tar_skill_sec = ChatPromptTemplate.from_template(tar_skill_sec_prompt)
prompt_skill_sec = pTem_tar_skill_sec.format_messages(skill_pri = skill_pri,lang = language,format_instructions = format_instructions)
#mock_skill_sec = chat_0_3(prompt_skill_sec)
mock_skill_sec = chat_0_4(prompt_skill_sec)
#print(mock_skill_sec)
mock_skill_sec_fin = mock_skill_sec.content.split(',')
#print(mock_skill_sec_fin)
return mock_skill_sec_fin
#社团生成函数
def soc_cr(target_job,language,key):
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}
"""
chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
pTem_tar_soc = ChatPromptTemplate.from_template(tar_soc_prompt)
prompt_soc = pTem_tar_soc.format_messages(job_name = target_job,lang = language,format_instructions = format_instructions)
mock_exp_soc = chat_0_4(prompt_soc)
#print(mock_exp_soc)
mock_exp_soc_fin = mock_exp_soc.content.split(',')
#print(mock_exp_soc_fin)
return mock_exp_soc_fin
#工作简历生成函数
def work_exp(mock_company,mock_title,mock_skill,language,key):
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. """
chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
pTem_tar_working_exp = ChatPromptTemplate.from_template(working_exp_prompt)
prompt_working_exp = pTem_tar_working_exp.format_messages(company = mock_company,lang = language,title = mock_title,skill_sec = mock_skill)
mock_working_exp = chat_0_4(prompt_working_exp)
#print(mock_working_exp)
mock_working_exp_fin = r_splitter.split_text(mock_working_exp.content)
#print(mock_working_exp_fin)
result = [mock_working_exp_fin[0],mock_working_exp_fin[1],mock_working_exp_fin[2]]
#print(mock_working_exp_fin[3])
#print(result)
return (mock_working_exp_fin[0],mock_working_exp_fin[1],mock_working_exp_fin[2])
def club_exp(mock_soc,mock_skill_soc,language,key):
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. """
chat_0_4 = ChatOpenAI(temperature = 0.0,model_name = 'gpt-4',openai_api_key = key)
#n_range = range(0,80)
#rand_value = random.sample(n_range,4)
#print(rand_value)
mock_skill_soc_fin = np.array(mock_skill_soc)[rand_value]
pTem_tar_club_exp = ChatPromptTemplate.from_template(club_exp_prompt)
prompt_club_exp = pTem_tar_club_exp.format_messages(club = mock_soc,lang = language,skill_sec_club = mock_skill_soc_fin)
#print(pTem_tar_club_exp)
#print(prompt_club_exp)
mock_club_exp = chat_0_4(prompt_club_exp)
#print(mock_club_exp)
mock_club_exp_fin = r_splitter.split_text(mock_club_exp.content)
#print(mock_club_exp_fin)
#print(mock_club_exp_fin[0])
return mock_club_exp_fin
#定义履历生成函数
def skill_info(job_req,language,key):
# 生成Skillset
mock_skill_pri = skill_pri_cr(job_req,key)
# 生成2级Skillset
mock_skill_sec = skill_sec_cr(mock_skill_pri,language,key)
return mock_skill_sec
#简历展示函数
def resume_header(name,mobile,email,Gra_beg,Gra_end,Gra_sch,Gra_maj,underGra_beg,underGra_end,underGra_sch,underGra_maj):
header = f"""
<main role="main">
<div class="page"><!-- 1. Header -->
<h1 style="text-align: center;">{name}</h1>
<p style="text-align: center;">Mobile:{mobile} Email:{email}</p>
<hr /><!-- 2a. Resume Content -->
<section class="resume_content">
<article>
<h3>Education Background</h3>
<div style="float: left;">{Gra_beg}-{Gra_end} <strong>{Gra_sch}</strong></div>
<div style="float: right;">{Gra_maj} <strong>Master</strong></div>
<br />
<div style="float: left;">{underGra_beg}-{underGra_end} <strong>{underGra_sch}</strong></div>
<div style="float: right;">{underGra_maj} <strong>Bachelor</strong></div>
<br /><hr />
<h3>Working Experience</h3>
</article>
</section>
</div>
</main>
"""
return header
def resume_working_exp(exp_beg,exp_end,exp_com,exp_title,exp_1,exp_2,exp_3):
working_exp = f"""
<main role="main">
<div class="page">
<section>
<div style="float: left;">{exp_beg}-{exp_end} <strong>{exp_com}</strong></div>
<div style="float: right;"><strong>{exp_title}</strong></div>
<br />
<ul>
<p><li>{exp_1}</li></p>
<p><li>{exp_2}</li></p>
<p><li>{exp_3}</li></p>
</ul>
</section>
</div>
</main>
"""
return working_exp
#简历排版函数
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,exp_four_beg,exp_four_end,exp_four_com,exp_four_title,exp_four_1,exp_four_2,exp_four_3):
# 生成html和pdf
pdfkit_options = {'encoding': 'UTF-8'}
body = f"""
<main role="main">
<div class="page"><!-- 1. Header -->
<h1 style="text-align: center;">{name}</h1>
<p style="text-align: center;">Mobile:{mobile} Email:{email}</p>
<hr /><!-- 2a. Resume Content -->
<section class="resume_content">
<article>
<h3>Education Background</h3>
<div style="float: left;">{Gra_beg}-{Gra_end} <strong>{Gra_sch}</strong></div>
<div style="float: right;">{Gra_maj} <strong>Master</strong></div>
<br />
<div style="float: left;">{underGra_beg}-{underGra_end} <strong>{underGra_sch}</strong></div>
<div style="float: right;">{underGra_maj} <strong>Bachelor</strong></div>
<br /><hr />
<h3>Working Experience</h3>
<section>
<div style="float: left;">{exp_one_beg}-{exp_one_end} <strong>{exp_one_com}</strong></div>
<div style="float: right;"><strong>{exp_one_title}</strong></div>
<br />
<ul>
<p><li>{exp_one_1}</li></p>
<p><li>{exp_one_2}</li></p>
<p><li>{exp_one_3}</li></p>
</ul>
<div style="float: left;">{exp_two_beg}-{exp_two_end} <strong>{exp_two_com}</strong></div>
<div style="float: right;"><strong>{exp_two_title}</strong></div>
<br />
<ul>
<p><li>{exp_two_1}</li></p>
<p><li>{exp_two_2}</li></p>
<p><li>{exp_two_3}</li></p>
</ul>
<div style="float: left;">{exp_three_beg}-{exp_three_end} <strong>{exp_three_com}</strong></div>
<div style="float: right;"><strong>{exp_three_title}</strong></div>
<br />
<ul>
<p><li>{exp_three_1}</li></p>
<p><li>{exp_three_2}</li></p>
<p><li>{exp_three_3}</li></p>
</ul>
<div style="float: left;">{exp_four_beg}-{exp_four_end} <strong>{exp_four_com}</strong></div>
<div style="float: right;"><strong>{exp_four_title}</strong></div>
<br />
<ul>
<p><li>{exp_four_1}</li></p>
<p><li>{exp_four_2}</li></p>
<p><li>{exp_four_3}</li></p>
</ul>
</article>
</section>
</div>
</main>
"""
pdfkit.from_string(body, "Resume.pdf",options=pdfkit_options) #with --page-size=Legal and --orientation=Landscape
return "Resume.pdf"
# In[ ]:
# In[65]:
# Json输入,Dropdown更新函数
def Dropdown_list(list_in):
new_options = list_in
return gr.Dropdown.update(choices=new_options)
# List内Json增加函数,输入Json,输出list
def Add_list(list_in,list_add):
list_out = list_in + list_add.split(",")
return list_out
# Json输入,Textbox默认值更新
def Textbox_value(list_in,num):
num = int(num)
new_value = list_in[num]
return gr.Textbox.update(value = new_value)
#Json输入,Dropdown默认值随机输出
def Dropdown_value_rand(list_in,num):
num = int(num)
n_range = range(0,80)
rand_value = np.random.randint(0,80,size = num)
list_out = np.array(list_in)[rand_value]
list_out = list_out.tolist()
return list_out
#Button触发其他Button的显示
def Button_visible():
return gr.Button.update(visible = True)
#文本框提交输出文本值
def Textbox_value_os(str_in):
return gr.Textbox.update(value = str_in)
#触发其他Textbox的显示
def Textbox_visible():
return gr.Textbox.update(visible = True)
#触发Button的不可点击态
def Button_inact():
return gr.Button.update(interactive = False)
#恢复Button的可点击态
def Button_act():
return gr.Button.update(interactive = True)
options = ['Select a company']
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
#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",)
#key = str(txt_openAI_key.change(Textbox_value_submit, inputs =txt_openAI_key))
#print(key)
txt_key = gr.Textbox(type="password", placeholder="sk..",label = "Openai API key")
#print(openai_gpt4_key)
txt_tarcom_in = gr.Textbox(label = "Target Company",info = "e.g. Amazon")
txt_tarjob_in = gr.Textbox(label = "Target Job",info = "e.g. Data Analyst")
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")
txt_lang_in = gr.Dropdown(["English"],label="Language", info="Choose the language of your resume")
btn_resume_info = gr.Button(value="Analyze Target Job")
#btn_resume_pre = gr.Button(value = "Preview Resume",visible = False)
js_com_out = gr.JSON(label = "Company output",visible = False)
js_title_out = gr.JSON(label = "Proper Title",visible = False)
js_sec_skill_out = gr.JSON(label = "Output",visible = False)
js_club_out = gr.JSON(label = "Output",visible = False)
#dd_com_in = gr.Dropdown(options)
notice = gr.Label("Please wait until resume is shown on the right side (around 90s with 4 paragraphs). Try to fill in bio below in this time.",visible = False)
with gr.Row():
name = gr.Textbox(label = "Name",visible = False)
mobile = gr.Textbox(label = "Mobile",visible = False)
email = gr.Textbox(label = "Email",visible = False)
with gr.Row():
Gra_beg = gr.Textbox(label = "Graduate School Beginning Year",visible = False)
Gra_end = gr.Textbox(label = "Graduate School End Year",visible = False)
Gra_sch = gr.Textbox(label = "Graduate School Name",visible = False)
Gra_maj = gr.Textbox(label = "Graduate School Major",visible = False)
with gr.Row():
underGra_beg = gr.Textbox(label = "Undergraduate School Beginning Year",visible = False)
underGra_end = gr.Textbox(label = "Undergraduate School End Year",visible = False)
underGra_sch = gr.Textbox(label = "Undergraduate School Name",visible = False)
underGra_maj = gr.Textbox(label = "Undergraduate School Major",visible = False)
btn_exp_gen = gr.Button(value = "Add Your Headers",visible = False)
with gr.Row():
exp_com_one = gr.Textbox(value = options,label="Company Name",visible = False)
exp_title_one = gr.Textbox(value = options,label="Title Name",visible = False)
time_beg_one = gr.Textbox(value = '2016',label = "Beginning years",visible = False)
time_end_one = gr.Textbox(value = '2017',label = "Ending years",visible = False)
exp_skill_one = gr.Dropdown(value = options, label = "Skill",multiselect = True,visible = False)
exp_txt_one_1 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_one_1_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
exp_txt_one_2 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_one_2_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
exp_txt_one_3 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_one_3_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
btn_work_exp_one = gr.Button(value = "Update Working Experience One",visible = False)
with gr.Row():
exp_com_two = gr.Textbox(value = options,label="Company Name",visible = False)
exp_title_two = gr.Textbox(value = options,label="Title Name",visible = False)
time_beg_two = gr.Textbox(value = '2016',label = "Beginning years",visible = False)
time_end_two = gr.Textbox(value = '2017',label = "Ending years",visible = False)
exp_skill_two = gr.Dropdown(value = options, label = "Skill",multiselect = True,visible = False)
exp_txt_two_1 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_two_1_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
exp_txt_two_2 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_two_2_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
exp_txt_two_3 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_two_3_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
btn_work_exp_two = gr.Button(value = "Update Working Experience Two",visible = False)
with gr.Row():
exp_com_three = gr.Textbox(value = options,label="Company Name",visible = False)
exp_title_three = gr.Textbox(value = options,label="Title Name",visible = False)
time_beg_three = gr.Textbox(value = '2016',label = "Beginning years",visible = False)
time_end_three = gr.Textbox(value = '2017',label = "Ending years",visible = False)
exp_skill_three = gr.Dropdown(value = options, label = "Skill",multiselect = True,visible = False)
exp_txt_three_1 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_three_1_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
exp_txt_three_2 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_three_2_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
exp_txt_three_3 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_three_3_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
btn_work_exp_three = gr.Button(value = "Update Working Experience Three",visible = False)
with gr.Row():
exp_com_four = gr.Textbox(value = options,label="Company Name",visible = False)
exp_title_four = gr.Textbox(value = options,label="Title Name",visible = False)
time_beg_four = gr.Textbox(value = '2016',label = "Beginning years",visible = False)
time_end_four = gr.Textbox(value = '2017',label = "Ending years",visible = False)
exp_skill_four = gr.Dropdown(value = options, label = "Skill",multiselect = True,visible = False)
exp_txt_four_1 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_four_1_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
exp_txt_four_2 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_four_2_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
exp_txt_four_3 = gr.Textbox(value = options,interactive = True,visible = False)
exp_txt_four_3_out = gr.Textbox(value = options,interactive = True,visible = False,label = "Working Experience")
btn_work_exp_four = gr.Button(value = "Update Working Experience four",visible = False)
with gr.Column():
webpage_1 = gr.HTML()
webpage_2 = gr.HTML()
webpage_3 = gr.HTML()
webpage_4 = gr.HTML()
webpage_5 = gr.HTML()
donate = gr.Markdown("Enjoy and generate your first AI resume. Wish you get all best offers.\n Please give your feedbacks so I can keep updating this project.\n Really appreciated for donating to the project if you like it.\n https://donate.stripe.com/7sI29DemibwjgkU4gg")
btn_resume_download = gr.Button(value = "Download Resume and Donate the Project",visible = False)
resume_file = gr.File(file_types = ["pdf"])
# Backend
num_one = gr.Textbox("0",visible = False)
num_two = gr.Textbox("1",visible = False)
num_three = gr.Textbox("2",visible = False)
num_four = gr.Textbox("3",visible = False)
num_rand = gr.Textbox("10",visible = False)
txt_key.change(Textbox_value_os,inputs = txt_key)
btn_resume_info.click(Button_inact,outputs = btn_resume_info)
btn_resume_info.click(company_cr, inputs = [txt_tarcom_in, txt_lang_in, txt_key], outputs = js_com_out)
btn_resume_info.click(job_cr, inputs = [txt_tarjob_in, txt_lang_in,txt_key], outputs = js_title_out)
btn_resume_info.click(skill_info, inputs = [txt_jd_in, txt_lang_in,txt_key], outputs = js_sec_skill_out)
btn_resume_info.click(Textbox_visible,outputs = notice)
btn_resume_info.click(Textbox_visible,outputs = name)
btn_resume_info.click(Textbox_visible,outputs = mobile)
btn_resume_info.click(Textbox_visible,outputs = email)
btn_resume_info.click(Textbox_visible,outputs = Gra_beg)
btn_resume_info.click(Textbox_visible,outputs = Gra_end)
btn_resume_info.click(Textbox_visible,outputs = Gra_sch)
btn_resume_info.click(Textbox_visible,outputs = Gra_maj)
btn_resume_info.click(Textbox_visible,outputs = underGra_beg)
btn_resume_info.click(Textbox_visible,outputs = underGra_end)
btn_resume_info.click(Textbox_visible,outputs = underGra_sch)
btn_resume_info.click(Textbox_visible,outputs = underGra_maj)
btn_resume_info.click(Button_visible,outputs = btn_exp_gen)
btn_exp_gen.click(resume_header,inputs=[name,mobile,email,Gra_beg,Gra_end,Gra_sch,Gra_maj,underGra_beg,underGra_end,underGra_sch,underGra_maj],outputs = webpage_1)
#btn_resume_info.click(Button_visible,outputs = btn_exp_gen,queue = True)
#btn_exp_gen.click(Textbox_value,inputs = [js_com_out,num_one],outputs = exp_com_one)
#btn_exp_gen.click(Textbox_value,inputs = [js_title_out,num_one],outputs = exp_title_one)
#btn_exp_gen.click(Dropdown_value_rand,inputs = [js_sec_skill_out,num_rand],outputs = exp_skill_one)
js_com_out.change(Textbox_value,inputs = [js_com_out,num_one],outputs = exp_com_one)
js_title_out.change(Textbox_value,inputs = [js_title_out,num_one],outputs = exp_title_one)
js_sec_skill_out.change(Dropdown_value_rand,inputs = [js_sec_skill_out,num_rand],outputs = exp_skill_one)
#js_com_out = gr.JSON(label = "Company output")
#js_title_out = gr.JSON(label = "Proper Title",visible = False)
#js_sec_skill_out = gr.JSON(label = "Output",visible = False)
#js_club_out = gr.JSON(label = "Output",visible = False)
exp_skill_one.change(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])
exp_txt_one_1.change(resume_working_exp,inputs=[time_beg_one,time_end_one,exp_com_one,exp_title_one,exp_txt_one_1,exp_txt_one_2,exp_txt_one_3],outputs = webpage_2)
exp_txt_one_1.change(Textbox_value_os,exp_txt_one_1,outputs = exp_txt_one_1_out)
exp_txt_one_2.change(Textbox_value_os,exp_txt_one_2,outputs = exp_txt_one_2_out)
exp_txt_one_3.change(Textbox_value_os,exp_txt_one_3,outputs = exp_txt_one_3_out)
exp_txt_one_1.change(Textbox_visible,outputs = exp_txt_one_1_out)
exp_txt_one_2.change(Textbox_visible,outputs = exp_txt_one_2_out)
exp_txt_one_3.change(Textbox_visible,outputs = exp_txt_one_3_out)
exp_txt_one_1.change(Textbox_visible,outputs = exp_com_one)
exp_txt_one_1.change(Textbox_visible,outputs = exp_title_one)
exp_txt_one_1.change(Textbox_visible,outputs = time_beg_one)
exp_txt_one_1.change(Textbox_visible,outputs = time_end_one)
exp_txt_one_1_out.submit(resume_working_exp,inputs=[time_beg_one,time_end_one,exp_com_one,exp_title_one,exp_txt_one_1_out,exp_txt_one_2_out,exp_txt_one_3_out],outputs = webpage_2)
exp_txt_one_2_out.submit(resume_working_exp,inputs=[time_beg_one,time_end_one,exp_com_one,exp_title_one,exp_txt_one_1_out,exp_txt_one_2_out,exp_txt_one_3_out],outputs = webpage_2)
exp_txt_one_3_out.submit(resume_working_exp,inputs=[time_beg_one,time_end_one,exp_com_one,exp_title_one,exp_txt_one_1_out,exp_txt_one_2_out,exp_txt_one_3_out],outputs = webpage_2)
time_beg_one.submit(resume_working_exp,inputs=[time_beg_one,time_end_one,exp_com_one,exp_title_one,exp_txt_one_1_out,exp_txt_one_2_out,exp_txt_one_3_out],outputs = webpage_2)
time_end_one.submit(resume_working_exp,inputs=[time_beg_one,time_end_one,exp_com_one,exp_title_one,exp_txt_one_1_out,exp_txt_one_2_out,exp_txt_one_3_out],outputs = webpage_2)
exp_com_one.submit(resume_working_exp,inputs=[time_beg_one,time_end_one,exp_com_one,exp_title_one,exp_txt_one_1_out,exp_txt_one_2_out,exp_txt_one_3_out],outputs = webpage_2)
exp_title_one.submit(resume_working_exp,inputs=[time_beg_one,time_end_one,exp_com_one,exp_title_one,exp_txt_one_1_out,exp_txt_one_2_out,exp_txt_one_3_out],outputs = webpage_2)
js_com_out.change(Textbox_value,inputs = [js_com_out,num_two],outputs = exp_com_two)
js_title_out.change(Textbox_value,inputs = [js_title_out,num_two],outputs = exp_title_two)
js_sec_skill_out.change(Dropdown_value_rand,inputs = [js_sec_skill_out,num_rand],outputs = exp_skill_two)
exp_txt_one_1.change(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])
exp_txt_two_1.change(resume_working_exp,inputs=[time_beg_two,time_end_two,exp_com_two,exp_title_two,exp_txt_two_1,exp_txt_two_2,exp_txt_two_3],outputs = webpage_3)
exp_txt_two_1.change(Textbox_value_os,exp_txt_two_1,outputs = exp_txt_two_1_out)
exp_txt_two_2.change(Textbox_value_os,exp_txt_two_2,outputs = exp_txt_two_2_out)
exp_txt_two_3.change(Textbox_value_os,exp_txt_two_3,outputs = exp_txt_two_3_out)
exp_txt_two_1.change(Textbox_visible,outputs = exp_txt_two_1_out)
exp_txt_two_2.change(Textbox_visible,outputs = exp_txt_two_2_out)
exp_txt_two_3.change(Textbox_visible,outputs = exp_txt_two_3_out)
exp_txt_two_1.change(Textbox_visible,outputs = exp_com_two)
exp_txt_two_1.change(Textbox_visible,outputs = exp_title_two)
exp_txt_two_1.change(Textbox_visible,outputs = time_beg_two)
exp_txt_two_1.change(Textbox_visible,outputs = time_end_two)
exp_txt_two_1_out.submit(resume_working_exp,inputs=[time_beg_two,time_end_two,exp_com_two,exp_title_two,exp_txt_two_1_out,exp_txt_two_2_out,exp_txt_two_3_out],outputs = webpage_3)
exp_txt_two_2_out.submit(resume_working_exp,inputs=[time_beg_two,time_end_two,exp_com_two,exp_title_two,exp_txt_two_1_out,exp_txt_two_2_out,exp_txt_two_3_out],outputs = webpage_3)
exp_txt_two_3_out.submit(resume_working_exp,inputs=[time_beg_two,time_end_two,exp_com_two,exp_title_two,exp_txt_two_1_out,exp_txt_two_2_out,exp_txt_two_3_out],outputs = webpage_3)
time_beg_two.submit(resume_working_exp,inputs=[time_beg_two,time_end_two,exp_com_two,exp_title_two,exp_txt_two_1_out,exp_txt_two_2_out,exp_txt_two_3_out],outputs = webpage_3)
time_end_two.submit(resume_working_exp,inputs=[time_beg_two,time_end_two,exp_com_two,exp_title_two,exp_txt_two_1_out,exp_txt_two_2_out,exp_txt_two_3_out],outputs = webpage_3)
exp_com_two.submit(resume_working_exp,inputs=[time_beg_two,time_end_two,exp_com_two,exp_title_two,exp_txt_two_1_out,exp_txt_two_2_out,exp_txt_two_3_out],outputs = webpage_3)
exp_title_two.submit(resume_working_exp,inputs=[time_beg_two,time_end_two,exp_com_two,exp_title_two,exp_txt_two_1_out,exp_txt_two_2_out,exp_txt_two_3_out],outputs = webpage_3)
js_com_out.change(Textbox_value,inputs = [js_com_out,num_three],outputs = exp_com_three)
js_title_out.change(Textbox_value,inputs = [js_title_out,num_one],outputs = exp_title_three)
js_sec_skill_out.change(Dropdown_value_rand,inputs = [js_sec_skill_out,num_rand],outputs = exp_skill_three)
exp_txt_two_1.change(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])
exp_txt_three_1.change(resume_working_exp,inputs=[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_4)
exp_txt_three_1.change(Textbox_value_os,exp_txt_three_1,outputs = exp_txt_three_1_out)
exp_txt_three_2.change(Textbox_value_os,exp_txt_three_2,outputs = exp_txt_three_2_out)
exp_txt_three_3.change(Textbox_value_os,exp_txt_three_3,outputs = exp_txt_three_3_out)
exp_txt_three_1.change(Textbox_visible,outputs = exp_txt_three_1_out)
exp_txt_three_2.change(Textbox_visible,outputs = exp_txt_three_2_out)
exp_txt_three_3.change(Textbox_visible,outputs = exp_txt_three_3_out)
exp_txt_three_1.change(Textbox_visible,outputs = exp_com_three)
exp_txt_three_1.change(Textbox_visible,outputs = exp_title_three)
exp_txt_three_1.change(Textbox_visible,outputs = time_beg_three)
exp_txt_three_1.change(Textbox_visible,outputs = time_end_three)
exp_txt_three_1_out.submit(resume_working_exp,inputs=[time_beg_three,time_end_three,exp_com_three,exp_title_three,exp_txt_three_1_out,exp_txt_three_2_out,exp_txt_three_3_out],outputs = webpage_4)
exp_txt_three_2_out.submit(resume_working_exp,inputs=[time_beg_three,time_end_three,exp_com_three,exp_title_three,exp_txt_three_1_out,exp_txt_three_2_out,exp_txt_three_3_out],outputs = webpage_4)
exp_txt_three_3_out.submit(resume_working_exp,inputs=[time_beg_three,time_end_three,exp_com_three,exp_title_three,exp_txt_three_1_out,exp_txt_three_2_out,exp_txt_three_3_out],outputs = webpage_4)
time_beg_three.submit(resume_working_exp,inputs=[time_beg_three,time_end_three,exp_com_three,exp_title_three,exp_txt_three_1_out,exp_txt_three_2_out,exp_txt_three_3_out],outputs = webpage_4)
time_end_three.submit(resume_working_exp,inputs=[time_beg_three,time_end_three,exp_com_three,exp_title_three,exp_txt_three_1_out,exp_txt_three_2_out,exp_txt_three_3_out],outputs = webpage_4)
exp_com_three.submit(resume_working_exp,inputs=[time_beg_three,time_end_three,exp_com_three,exp_title_three,exp_txt_three_1_out,exp_txt_three_2_out,exp_txt_three_3_out],outputs = webpage_4)
exp_title_three.submit(resume_working_exp,inputs=[time_beg_three,time_end_three,exp_com_three,exp_title_three,exp_txt_three_1_out,exp_txt_three_2_out,exp_txt_three_3_out],outputs = webpage_4)
js_com_out.change(Textbox_value,inputs = [js_com_out,num_four],outputs = exp_com_four)
js_title_out.change(Textbox_value,inputs = [js_title_out,num_one],outputs = exp_title_four)
js_sec_skill_out.change(Dropdown_value_rand,inputs = [js_sec_skill_out,num_rand],outputs = exp_skill_four)
exp_txt_three_1.change(work_exp, inputs=[exp_com_four,exp_title_four,exp_skill_four,txt_lang_in,txt_key],outputs = [exp_txt_four_1,exp_txt_four_2,exp_txt_four_3])
exp_txt_four_1.change(resume_working_exp,inputs=[time_beg_four,time_end_four,exp_com_four,exp_title_four,exp_txt_four_1,exp_txt_four_2,exp_txt_four_3],outputs = webpage_5)
exp_txt_four_1.change(Textbox_value_os,exp_txt_four_1,outputs = exp_txt_four_1_out)
exp_txt_four_2.change(Textbox_value_os,exp_txt_four_2,outputs = exp_txt_four_2_out)
exp_txt_four_3.change(Textbox_value_os,exp_txt_four_3,outputs = exp_txt_four_3_out)
exp_txt_four_1.change(Textbox_visible,outputs = exp_txt_four_1_out)
exp_txt_four_2.change(Textbox_visible,outputs = exp_txt_four_2_out)
exp_txt_four_3.change(Textbox_visible,outputs = exp_txt_four_3_out)
exp_txt_four_1.change(Textbox_visible,outputs = exp_com_four)
exp_txt_four_1.change(Textbox_visible,outputs = exp_title_four)
exp_txt_four_1.change(Textbox_visible,outputs = time_beg_four)
exp_txt_four_1.change(Textbox_visible,outputs = time_end_four)
exp_txt_four_1_out.submit(resume_working_exp,inputs=[time_beg_four,time_end_four,exp_com_four,exp_title_four,exp_txt_four_1_out,exp_txt_four_2_out,exp_txt_four_3_out],outputs = webpage_5)
exp_txt_four_2_out.submit(resume_working_exp,inputs=[time_beg_four,time_end_four,exp_com_four,exp_title_four,exp_txt_four_1_out,exp_txt_four_2_out,exp_txt_four_3_out],outputs = webpage_5)
exp_txt_four_3_out.submit(resume_working_exp,inputs=[time_beg_four,time_end_four,exp_com_four,exp_title_four,exp_txt_four_1_out,exp_txt_four_2_out,exp_txt_four_3_out],outputs = webpage_5)
time_beg_four.submit(resume_working_exp,inputs=[time_beg_four,time_end_four,exp_com_four,exp_title_four,exp_txt_four_1_out,exp_txt_four_2_out,exp_txt_four_3_out],outputs = webpage_5)
time_end_four.submit(resume_working_exp,inputs=[time_beg_four,time_end_four,exp_com_four,exp_title_four,exp_txt_four_1_out,exp_txt_four_2_out,exp_txt_four_3_out],outputs = webpage_5)
exp_com_four.submit(resume_working_exp,inputs=[time_beg_four,time_end_four,exp_com_four,exp_title_four,exp_txt_four_1_out,exp_txt_four_2_out,exp_txt_four_3_out],outputs = webpage_5)
exp_title_four.submit(resume_working_exp,inputs=[time_beg_four,time_end_four,exp_com_four,exp_title_four,exp_txt_four_1_out,exp_txt_four_2_out,exp_txt_four_3_out],outputs = webpage_5)
#btn_exp_gen.click(Button_visible,outputs = btn_resume_gen)
#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])
#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])
#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])
#btn_resume_gen.click(Button_visible,outputs = btn_resume_pre)
exp_txt_three_1.change(Button_act,outputs = btn_resume_info)
btn_exp_gen.click(Button_visible,outputs = btn_resume_download)
#btn_resume_pre.click(resume_header,inputs=[name,mobile,email,Gra_beg,Gra_end,Gra_sch,Gra_maj,underGra_beg,underGra_end,underGra_sch,underGra_maj],outputs = webpage_1)
btn_resume_download.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,time_beg_four,time_end_four,exp_com_four,exp_title_four,exp_txt_four_1,exp_txt_four_2,exp_txt_four_3],outputs = resume_file)
if __name__ == "__main__":
demo.launch(enable_queue = True)
# In[ ]:
# In[ ]:
|