Spaces:
Runtime error
Runtime error
SujanMidatani
commited on
Commit
•
2366ab0
1
Parent(s):
54710aa
create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain.chains import LLMChain
|
2 |
+
from langchain.llms import OpenAI
|
3 |
+
import gradio as gr
|
4 |
+
from dotenv import load_dotenv
|
5 |
+
|
6 |
+
load_dotenv()
|
7 |
+
def generate_questions(resume,role='',experience=''):
|
8 |
+
_PROMPT_TEMPLATE = """
|
9 |
+
this is the resume of user:
|
10 |
+
{resume_details}
|
11 |
+
|
12 |
+
here is the role he want to join in :
|
13 |
+
{role}
|
14 |
+
|
15 |
+
Based on the following experience:
|
16 |
+
{experience}
|
17 |
+
|
18 |
+
What are your interview questions for the given user resume and role he want to join in with that experience?
|
19 |
+
generate no of questions = {questions}!
|
20 |
+
"""
|
21 |
+
PROMPT = PromptTemplate(input_variables=["resume_details", "role", "experience",'questions'], template=_PROMPT_TEMPLATE)
|
22 |
+
|
23 |
+
llm1 = OpenAI(model_name="text-davinci-003", temperature=0)
|
24 |
+
chain = LLMChain(llm=llm1, prompt=PROMPT)
|
25 |
+
prompt = chain.predict_and_parse(resume_details= gen_text(resume),
|
26 |
+
role= role,
|
27 |
+
experience= experience,
|
28 |
+
questions=10)
|
29 |
+
return prompt.split('\n')
|
30 |
+
k=gr.Interface(
|
31 |
+
fn=generate_questions,
|
32 |
+
inputs=['json','text','text'],
|
33 |
+
outputs=['text']
|
34 |
+
)
|
35 |
+
k.launch()
|