Spaces:
Runtime error
Runtime error
Commit ·
603c081
1
Parent(s): 283b28d
main
Browse files
app.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from api_key import apikey
|
| 3 |
+
|
| 4 |
+
import streamlit as st
|
| 5 |
+
from langchain.llms import OpenAI
|
| 6 |
+
from langchain.prompts import PromptTemplate
|
| 7 |
+
from langchain.memory import ConversationBufferMemory
|
| 8 |
+
from langchain.chains import LLMChain
|
| 9 |
+
|
| 10 |
+
os.environ['OPENAI_API_KEY'] = apikey
|
| 11 |
+
|
| 12 |
+
#APP FRAMEWORK
|
| 13 |
+
st.title('🦜️🔗 RESUME GPT CREATOR')
|
| 14 |
+
prompt = st.text_input("Enter the JD on which you want to generate Resume")
|
| 15 |
+
|
| 16 |
+
#PROMPT RESUME TEMPLATE
|
| 17 |
+
resume_template = PromptTemplate(
|
| 18 |
+
input_variables = ['topic'],
|
| 19 |
+
template='write me a resume about the Job Discription of {topic}'
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# #COVER LETTER RESUME
|
| 23 |
+
# letter_template = PromptTemplate(
|
| 24 |
+
# input_variables = ['title'],
|
| 25 |
+
# template='write me a cover letter based on the following resume: {title}'
|
| 26 |
+
# )
|
| 27 |
+
|
| 28 |
+
# MEMORY
|
| 29 |
+
resume_memory = ConversationBufferMemory(input_key='topic', memory_key='chat_history')
|
| 30 |
+
# letter_memory = ConversationBufferMemory(input_key='title', memory_key='chat_history')
|
| 31 |
+
|
| 32 |
+
# LLMS
|
| 33 |
+
llm = OpenAI(temperature=0.9)
|
| 34 |
+
resume_chain = LLMChain(llm=llm, prompt=resume_template, verbose=False, output_key='title', memory=resume_memory)
|
| 35 |
+
# letter_chain = LLMChain(llm=llm, prompt=letter_template, verbose=True, output_key='script', memory=letter_memory)
|
| 36 |
+
# Sequential_Chain = SequentialChain(chains=[resume_chain, letter_chain],
|
| 37 |
+
# input_variables=['topic'],
|
| 38 |
+
# output_variable=['title','script'])
|
| 39 |
+
|
| 40 |
+
#SHOW STUFF ON THE SCREEN
|
| 41 |
+
if prompt:
|
| 42 |
+
response = resume_chain.run(prompt,)
|
| 43 |
+
st.write(response)
|
| 44 |
+
# st.write(response['title'])
|
| 45 |
+
# st.write(response['script'])
|
| 46 |
+
|