Spaces:
Sleeping
Sleeping
raghavgpt001
commited on
Commit
•
90afe9f
1
Parent(s):
7e54064
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,8 @@ from langchain_core.prompts import FewShotPromptTemplate
|
|
5 |
from langchain.prompts.example_selector import LengthBasedExampleSelector
|
6 |
|
7 |
def getLLMResponse(query,age_option,tasktype_option,numberOfWords):
|
8 |
-
|
|
|
9 |
|
10 |
examples=[]
|
11 |
if age_option=="Kids": #Silly and Sweet Kid
|
@@ -98,6 +99,11 @@ def getLLMResponse(query,age_option,tasktype_option,numberOfWords):
|
|
98 |
|
99 |
#Frontend Starts here
|
100 |
|
|
|
|
|
|
|
|
|
|
|
101 |
st.set_page_config(page_title="Marketing Tool",
|
102 |
page_icon='✅',
|
103 |
layout='centered',
|
@@ -119,5 +125,5 @@ numberOfWords= st.slider('Words limit', 1, 200, 25)
|
|
119 |
submit = st.button("Generate")
|
120 |
|
121 |
if submit:
|
122 |
-
st.write(getLLMResponse(form_input,age_option,tasktype_option,numberOfWords))
|
123 |
|
|
|
5 |
from langchain.prompts.example_selector import LengthBasedExampleSelector
|
6 |
|
7 |
def getLLMResponse(query,age_option,tasktype_option,numberOfWords):
|
8 |
+
|
9 |
+
llm = OpenAI(model="gpt-3.5-turbo-instruct", temperature=.9, api_key=st.session_state['API_Key'])
|
10 |
|
11 |
examples=[]
|
12 |
if age_option=="Kids": #Silly and Sweet Kid
|
|
|
99 |
|
100 |
#Frontend Starts here
|
101 |
|
102 |
+
if 'API_Key' not in st.session_state:
|
103 |
+
st.session_state['API_Key'] =''
|
104 |
+
|
105 |
+
st.session_state['API_Key']= st.sidebar.text_input("What's your OpenAI API key?",type="password")
|
106 |
+
|
107 |
st.set_page_config(page_title="Marketing Tool",
|
108 |
page_icon='✅',
|
109 |
layout='centered',
|
|
|
125 |
submit = st.button("Generate")
|
126 |
|
127 |
if submit:
|
128 |
+
st.write(getLLMResponse(form_input,age_option,tasktype_option, numberOfWords))
|
129 |
|