Spaces:
Runtime error
Runtime error
Commit Β·
f3efe74
1
Parent(s): 6f68631
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,12 +2,11 @@ import streamlit as st
|
|
| 2 |
import openai
|
| 3 |
from PIL import Image
|
| 4 |
import os
|
| 5 |
-
api_key = os.environ['open_ai_api']
|
| 6 |
-
|
| 7 |
|
|
|
|
| 8 |
openai.api_key = api_key
|
| 9 |
|
| 10 |
-
st.set_page_config(page_title="App by Adam", page_icon=":fork_and_knife:"
|
| 11 |
|
| 12 |
messages = [
|
| 13 |
{"role": "system", "content": "you are a nutritionist and professional chef specializing in the Healthy Keto Diet (70 % fat, 20 % protein, 5 % carbs), no or low sugar, no grains, legumes or beans."},
|
|
@@ -23,13 +22,19 @@ def chatbot(input):
|
|
| 23 |
messages.append({"role": "assistant", "content": reply})
|
| 24 |
return reply
|
| 25 |
|
| 26 |
-
st.title("
|
| 27 |
st.title("Your Healthy Keto expert")
|
| 28 |
|
| 29 |
# Add image to the sidebar
|
| 30 |
-
st.sidebar.image("image.jpg", width=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
input_text = st.text_input("Ask me about food π, nutrition π, and illness π€")
|
| 33 |
if st.button("Send"):
|
| 34 |
response = chatbot(input_text)
|
| 35 |
st.write(response)
|
|
|
|
|
|
| 2 |
import openai
|
| 3 |
from PIL import Image
|
| 4 |
import os
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
api_key = os.environ['open_ai_api']
|
| 7 |
openai.api_key = api_key
|
| 8 |
|
| 9 |
+
st.set_page_config(page_title="App by Adam", page_icon=":fork_and_knife:")
|
| 10 |
|
| 11 |
messages = [
|
| 12 |
{"role": "system", "content": "you are a nutritionist and professional chef specializing in the Healthy Keto Diet (70 % fat, 20 % protein, 5 % carbs), no or low sugar, no grains, legumes or beans."},
|
|
|
|
| 22 |
messages.append({"role": "assistant", "content": reply})
|
| 23 |
return reply
|
| 24 |
|
| 25 |
+
st.title("Adam")
|
| 26 |
st.title("Your Healthy Keto expert")
|
| 27 |
|
| 28 |
# Add image to the sidebar
|
| 29 |
+
st.sidebar.image("image.jpg", width=100, use_column_width=True)
|
| 30 |
+
|
| 31 |
+
# Increase font size for better legibility on mobile devices
|
| 32 |
+
st.markdown("<style>body { font-size: 18px; }</style>", unsafe_allow_html=True)
|
| 33 |
+
|
| 34 |
+
# Use a mobile-friendly input method
|
| 35 |
+
input_text = st.selectbox("Ask me about food π, nutrition π, and illness π€", ["", "food", "nutrition", "illness"])
|
| 36 |
|
|
|
|
| 37 |
if st.button("Send"):
|
| 38 |
response = chatbot(input_text)
|
| 39 |
st.write(response)
|
| 40 |
+
|