Spaces:
Runtime error
Runtime error
File size: 1,070 Bytes
2366ab0 e3fa3f7 2366ab0 |
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 |
from langchain.chains import LLMChain
from langchain.llms import OpenAI
import gradio as gr
from dotenv import load_dotenv
load_dotenv()
def generate_questions(resume,role='',experience=''):
_PROMPT_TEMPLATE = """
this is the resume of user:
{resume_details}
here is the role he want to join in :
{role}
Based on the following experience:
{experience}
What are your interview questions for the given user resume and role he want to join in with that experience?
generate no of questions = {questions}!
"""
PROMPT = PromptTemplate(input_variables=["resume_details", "role", "experience",'questions'], template=_PROMPT_TEMPLATE)
llm1 = OpenAI(model_name="text-davinci-003", temperature=0)
chain = LLMChain(llm=llm1, prompt=PROMPT)
prompt = chain.predict_and_parse(resume_details= gen_text(resume),
role= role,
experience= experience,
questions=10)
return prompt.split('\n')
k=gr.Interface(
fn=generate_questions,
inputs=['textbox','text','text'],
outputs=['text']
)
k.launch() |