Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files
Procfile
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
web: sh setup.sh && streamlit run app.py
|
app.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import openai
|
3 |
+
|
4 |
+
# Set up OpenAI API credentials
|
5 |
+
openai.api_key = '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'
|
6 |
+
|
7 |
+
def get_food_recommendation(prompt):
|
8 |
+
# Generate a response using the ChatGPT API
|
9 |
+
response = openai.Completion.create(
|
10 |
+
engine='text-davinci-003',
|
11 |
+
prompt=prompt,
|
12 |
+
max_tokens=500,
|
13 |
+
n=1,
|
14 |
+
stop=None,
|
15 |
+
temperature=0.7
|
16 |
+
)
|
17 |
+
|
18 |
+
# Extract the recommended food from the API response
|
19 |
+
recommendation = response.choices[0].text.strip()
|
20 |
+
|
21 |
+
return recommendation
|
22 |
+
|
23 |
+
# Streamlit app
|
24 |
+
def main():
|
25 |
+
st.title("Food and Nutrition Recommendation System")
|
26 |
+
prompt = st.text_area("Enter your request for food recommendation")
|
27 |
+
|
28 |
+
if st.button("Get Recommendation"):
|
29 |
+
if prompt:
|
30 |
+
recommendation_prompt = f"I'm looking for a food recommendation with the complete ingredients list based on the following criteria: {prompt}"
|
31 |
+
recommendation = get_food_recommendation(recommendation_prompt)
|
32 |
+
st.markdown("Recommendation: " + recommendation)
|
33 |
+
else:
|
34 |
+
st.warning("Please enter your request.")
|
35 |
+
|
36 |
+
if __name__ == "__main__":
|
37 |
+
main()
|
38 |
+
|
39 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
altair==4.2.0
|
2 |
+
ecos==2.0.10
|
3 |
+
entrypoints==0.4
|
4 |
+
folium==0.14.0
|
5 |
+
GitPython==3.1.29
|
6 |
+
google==3.0.0
|
7 |
+
google-auth==2.17.2
|
8 |
+
google-auth-oauthlib==1.0.0
|
9 |
+
google-search-results==2.4.2
|
10 |
+
googletrans==4.0.0rc1
|
11 |
+
gTTS==2.3.1
|
12 |
+
h11==0.9.0
|
13 |
+
h2==3.2.0
|
14 |
+
huggingface-hub==0.13.3
|
15 |
+
ipython==8.5.0
|
16 |
+
streamlit==1.16.0
|
17 |
+
streamlit-nightly
|
18 |
+
streamlit-folium
|
19 |
+
|
setup.sh
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
mkdir -p ~/.streamlit
|
2 |
+
|
3 |
+
echo "[server]
|
4 |
+
headless = true
|
5 |
+
port = $PORT
|
6 |
+
enableCORS = false
|
7 |
+
" > ~/.streamlit/config.toml
|