Spaces:
Runtime error
Runtime error
Commit Β·
cd9ff70
1
Parent(s): 4dd2a1a
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,25 +15,30 @@ messages = [
|
|
| 15 |
def chatbot(input):
|
| 16 |
if input:
|
| 17 |
messages.append({"role": "user", "content": input})
|
| 18 |
-
chat = openai.
|
| 19 |
-
|
| 20 |
)
|
| 21 |
-
reply = chat.choices[0].
|
| 22 |
messages.append({"role": "assistant", "content": reply})
|
| 23 |
return reply
|
| 24 |
|
| 25 |
st.title("Adam")
|
| 26 |
st.title("Your Healthy Keto expert")
|
| 27 |
|
|
|
|
|
|
|
| 28 |
|
|
|
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
input_text = st.text_input("Ask me about food π, nutrition π, and illness π€")
|
| 35 |
-
|
| 36 |
-
if st.button("Send"):
|
| 37 |
response = chatbot(input_text)
|
| 38 |
st.write(response)
|
| 39 |
-
|
|
|
|
| 15 |
def chatbot(input):
|
| 16 |
if input:
|
| 17 |
messages.append({"role": "user", "content": input})
|
| 18 |
+
chat = openai.Completion.create(
|
| 19 |
+
engine="davinci", prompt=messages, max_tokens=1024, n=1,stop=None,temperature=0.7
|
| 20 |
)
|
| 21 |
+
reply = chat.choices[0].text
|
| 22 |
messages.append({"role": "assistant", "content": reply})
|
| 23 |
return reply
|
| 24 |
|
| 25 |
st.title("Adam")
|
| 26 |
st.title("Your Healthy Keto expert")
|
| 27 |
|
| 28 |
+
# Center the text and enlarge the font
|
| 29 |
+
st.markdown("<h1 style='text-align: center; font-size: 24px;'>Ask me about food π, nutrition π, and illness π€</h1>", unsafe_allow_html=True)
|
| 30 |
|
| 31 |
+
input_text = st.text_input("Type here", key="input")
|
| 32 |
|
| 33 |
+
# Center and enlarge the send button
|
| 34 |
+
col1, col2, col3 = st.beta_columns([1, 8, 1])
|
| 35 |
+
with col2:
|
| 36 |
+
send = st.button("Send", key="send")
|
| 37 |
+
send.style.button_width = "100%"
|
| 38 |
+
send.style.font_size = "20px"
|
| 39 |
+
send.style.margin_top = "20px"
|
| 40 |
+
send.style.margin_bottom = "20px"
|
| 41 |
|
| 42 |
+
if send:
|
|
|
|
|
|
|
|
|
|
| 43 |
response = chatbot(input_text)
|
| 44 |
st.write(response)
|
|
|