Spaces:
Runtime error
Runtime error
Update app.py
Browse files70 unmodified lines717273747576777873 unmodified lines1521531541551561571581591601611621631641651661671681691708 unmodified lines17918018118218318418570 unmodified lineshtml_content += "</body></html>"return html_contentdef craft_cv(llm, cv_text, job_description, maxtokens, temperature, top_probability):# def craft_cv(llm, prompt, maxtokens, temperature, top_probability):instruction = "Given input CV and job description. Please revise the CV according to the given job description and output the revised CV."output = llm.create_chat_completion(messages=[73 unmodified lines# def pdf_to_text(prompt, maxtokens=2048, temperature=0, top_probability=0.95):@spaces.GPU(duration=40)def pdf_to_text(cv_file, job_description, maxtokens=2048, temperature=0, top_probability=0.95):converter = DocumentConverter()result = converter.convert(cv_file)cv_text = result.document.export_to_markdown()llm = Llama(model_path="models/" + model_id,flash_attn=True,n_gpu_layers=81,n_batch=1024,n_ctx=8192,)cv_text, crafted_cv = craft_cv(llm, cv_text, job_description, maxtokens, temperature, top_probability)# cv_text, crafted_cv = craft_cv(llm, prompt, maxtokens, temperature, top_probability)crafted_cv = convert_to_json(llm, crafted_cv, maxtokens, temperature, top_probability)8 unmodified linesllm_type = gr.Radio(["Fine tuned Llama3"])iface = gr.Interface(fn=pdf_to_text,inputs=[cv_file, prompt_text],outputs=['text'],title='Craft CV',description="This application assists to customize CV based on input job description",70 unmodified lines717273747576777873 unmodified lines1521531541551561571581591601611621631641651661671681691701718 unmodified lines18018118218318418518670 unmodified lineshtml_content += "</body></html>"return html_content# def craft_cv(llm, prompt, maxtokens, temperature, top_probability):def craft_cv(llm, cv_text, job_description, maxtokens, temperature, top_probability):instruction = "Given input CV and job description. Please revise the CV according to the given job description and output the revised CV."output = llm.create_chat_completion(messages=[73 unmodified lines# def pdf_to_text(prompt, maxtokens=2048, temperature=0, top_probability=0.95):@spaces.GPU(duration=40)def pdf_to_text(cv_file, job_description, llm_type='Fine tuned Llama3', maxtokens=2048, temperature=0, top_probability=0.95):converter = DocumentConverter()result = converter.convert(cv_file)cv_text = result.document.export_to_markdown()if(llm_type=='Fine tuned Llama3'):llm = Llama(model_path="models/" + model_id,flash_attn=True,n_gpu_layers=81,n_batch=1024,n_ctx=8192,)cv_text, crafted_cv = craft_cv(llm, cv_text, job_description, maxtokens, temperature, top_probability)# cv_text, crafted_cv = craft_cv(llm, prompt, maxtokens, temperature, top_probability)crafted_cv = convert_to_json(llm, crafted_cv, maxtokens, temperature, top_probability)8 unmodified linesllm_type = gr.Radio(["Fine tuned Llama3"])iface = gr.Interface(fn=pdf_to_text,inputs=[cv_file, prompt_text, llm_type],outputs=['text'],title='Craft CV',description="This application assists to customize CV based on input job description",
app.py+12-11