resumeGPT / app.py
tengqf's picture
Upload app.py
b69e1e6
raw
history blame
39.4 kB
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
sudo apt install -y python-yaml docker.io vagrant virtualbox p7zip-full
# 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}&nbsp; &nbsp; Email:{email}</p>
<hr /><!-- 2a. Resume Content -->
<section class="resume_content">
<article>
<h3>Education Background</h3>
<div style="float: left;">{Gra_beg}-{Gra_end}&nbsp; &nbsp; <strong>{Gra_sch}</strong></div>
<div style="float: right;">{Gra_maj}&nbsp; &nbsp; <strong>Master</strong></div>
<br />
<div style="float: left;">{underGra_beg}-{underGra_end}&nbsp; &nbsp; <strong>{underGra_sch}</strong></div>
<div style="float: right;">{underGra_maj}&nbsp; &nbsp; <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}&nbsp; &nbsp; <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}&nbsp; &nbsp; Email:{email}</p>
<hr /><!-- 2a. Resume Content -->
<section class="resume_content">
<article>
<h3>Education Background</h3>
<div style="float: left;">{Gra_beg}-{Gra_end}&nbsp; &nbsp; <strong>{Gra_sch}</strong></div>
<div style="float: right;">{Gra_maj}&nbsp; &nbsp; <strong>Master</strong></div>
<br />
<div style="float: left;">{underGra_beg}-{underGra_end}&nbsp; &nbsp; <strong>{underGra_sch}</strong></div>
<div style="float: right;">{underGra_maj}&nbsp; &nbsp; <strong>Bachelor</strong></div>
<br /><hr />
<h3>Working Experience</h3>
<section>
<div style="float: left;">{exp_one_beg}-{exp_one_end}&nbsp; &nbsp; <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}&nbsp; &nbsp; <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}&nbsp; &nbsp; <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}&nbsp; &nbsp; <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[ ]: