Nullzero commited on
Commit
f2b2988
·
1 Parent(s): 69a0c76

updated app

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -18,19 +18,19 @@ from langchain.chains import SimpleSequentialChain
18
 
19
  def load_chain(api_key):
20
  os.environ["OPENAI_API_KEY"] = api_key
21
- llm = OpenAI(temperature=0.3)
22
  #user_in = input("Please describe your Python project in one to two sentences: ")
23
 
24
  first_prompt = PromptTemplate(
25
  input_variables=["user_in"],
26
- template= "You are a senior Python Engineer. List five steps required to develop the software project specified. Only include the 5 steps as a high level outline. Explain that this is only a guide. \n\n {user_in}"
27
  )
28
  #First chain
29
  chain = LLMChain(llm=llm, prompt=first_prompt)
30
 
31
  second_prompt = PromptTemplate(
32
- input_variables=["project"],
33
- template= "As the senior engineer, Produce the python3 code for each step of the software {project} described. Use appropriate style, classes and variables. Be verbose in the code and opinionated about framework choice.:"
34
  )
35
 
36
  chain_two = LLMChain(llm=llm, prompt=second_prompt)
@@ -58,7 +58,7 @@ if "past" not in st.session_state:
58
 
59
 
60
  def get_text():
61
- user_input = st.text_input("Please describe your desired python code in 1-2 sentences", key="input")
62
  return user_input
63
 
64
 
@@ -69,11 +69,11 @@ if user_input:
69
  chain = load_chain(openai_api_key)
70
  output = chain.run(input=user_input)
71
 
72
- #st.session_state.past.append(user_input)
73
  st.session_state.generated.append(output)
74
 
75
  if st.session_state["generated"]:
76
 
77
  for i in range(len(st.session_state["generated"]) - 1, -1, -1):
78
  message(st.session_state["generated"][i], key=str(i))
79
- #message(st.session_state["past"][i], is_user=True, key=str(i) + "_user")
 
18
 
19
  def load_chain(api_key):
20
  os.environ["OPENAI_API_KEY"] = api_key
21
+ llm = OpenAI(model_name="gpt-3.5-turbo", temperature=0.1)
22
  #user_in = input("Please describe your Python project in one to two sentences: ")
23
 
24
  first_prompt = PromptTemplate(
25
  input_variables=["user_in"],
26
+ template= "Write the outline of the coding steps to develop the program {user_in} in five steps. Use Python3 and Be concise. \n\n"
27
  )
28
  #First chain
29
  chain = LLMChain(llm=llm, prompt=first_prompt)
30
 
31
  second_prompt = PromptTemplate(
32
+ input_variables=["program"],
33
+ template= '''Produce the python3 code for each step of the {program} described. Use python3 style. Be concise in the code and opinionated about framework choice.'''
34
  )
35
 
36
  chain_two = LLMChain(llm=llm, prompt=second_prompt)
 
58
 
59
 
60
  def get_text():
61
+ user_input = st.text_input("Please describe your desired python project in 1-2 sentences. The output will be five steps including code.", key="input")
62
  return user_input
63
 
64
 
 
69
  chain = load_chain(openai_api_key)
70
  output = chain.run(input=user_input)
71
 
72
+ st.session_state.past.append(user_input)
73
  st.session_state.generated.append(output)
74
 
75
  if st.session_state["generated"]:
76
 
77
  for i in range(len(st.session_state["generated"]) - 1, -1, -1):
78
  message(st.session_state["generated"][i], key=str(i))
79
+ message(st.session_state["past"][i], is_user=True, key=str(i) + "_user")