Spaces:
Runtime error
Runtime error
Added api keys and logic for getting keys
Browse files
.env
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
OPENAI_API_KEY = "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"
|
2 |
+
GOOGLE_MAPS_API_KEY = "AIzaSyCLT0v2qNV-BcWltldaNuYzP9_zniNrf-c"
|
3 |
+
GOOGLE_PALM_API_KEY = "AIzaSyDm-Z9hYOIjXL1no7BF2kBaFed9LZWrJqU"
|
app.py
CHANGED
@@ -1,5 +1,14 @@
|
|
1 |
import streamlit as st
|
2 |
from datetime import datetime, timedelta, date
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Title of the application
|
5 |
st.title('Smart Travel Itinerary Suggester')
|
@@ -48,7 +57,7 @@ with st.sidebar:
|
|
48 |
# Preferences multiselect
|
49 |
attractions = st.multiselect(
|
50 |
'What attractions are you interested in?',
|
51 |
-
['Museums', 'Parks', 'Beaches', 'Historical Sites', 'Art Galleries'],
|
52 |
help='Select multiple options by holding down the Ctrl (Cmd on Mac) button while clicking.'
|
53 |
)
|
54 |
|
|
|
1 |
import streamlit as st
|
2 |
from datetime import datetime, timedelta, date
|
3 |
+
from config import load_secrets
|
4 |
+
|
5 |
+
# Load the API secrets at the start of your app
|
6 |
+
secrets = load_secrets()
|
7 |
+
|
8 |
+
# Then use the secrets as needed, for example
|
9 |
+
openai_api_key = secrets["OPENAI_API_KEY"]
|
10 |
+
google_maps_api_key = secrets["GOOGLE_MAPS_API_KEY"]
|
11 |
+
google_palm_api_key = secrets["GOOGLE_PALM_API_KEY"]
|
12 |
|
13 |
# Title of the application
|
14 |
st.title('Smart Travel Itinerary Suggester')
|
|
|
57 |
# Preferences multiselect
|
58 |
attractions = st.multiselect(
|
59 |
'What attractions are you interested in?',
|
60 |
+
['Museums', 'Parks', 'Beaches', 'Historical Sites', 'Art Galleries', 'Famous', 'Carnivals'],
|
61 |
help='Select multiple options by holding down the Ctrl (Cmd on Mac) button while clicking.'
|
62 |
)
|
63 |
|
config.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
from pathlib import Path
|
4 |
+
|
5 |
+
def load_secrets():
|
6 |
+
if not os.getenv("OPENAI_API_KEY"):
|
7 |
+
env_path = Path('.') / '.env'
|
8 |
+
load_dotenv(dotenv_path=env_path)
|
9 |
+
|
10 |
+
open_ai_key = os.getenv("OPENAI_API_KEY")
|
11 |
+
google_maps_key = os.getenv("GOOGLE_MAPS_API_KEY")
|
12 |
+
google_palm_key = os.getenv("GOOGLE_PALM_API_KEY")
|
13 |
+
|
14 |
+
# Make sure to check if keys were successfully loaded and handle accordingly
|
15 |
+
if not open_ai_key or not google_maps_key or not google_palm_key:
|
16 |
+
raise Exception("API keys not found. Ensure .env file is set up correctly for local development or secrets are set for deployment.")
|
17 |
+
|
18 |
+
return {
|
19 |
+
"OPENAI_API_KEY": open_ai_key,
|
20 |
+
"GOOGLE_MAPS_API_KEY": google_maps_key,
|
21 |
+
"GOOGLE_PALM_API_KEY": google_palm_key,
|
22 |
+
}
|
requirements.txt
CHANGED
@@ -1,7 +1,15 @@
|
|
1 |
-
streamlit
|
2 |
requests>=2.26.0
|
3 |
pandas>=1.3.5
|
4 |
-
folium>=0.
|
5 |
streamlit-folium>=0.4.0
|
6 |
-
python-dotenv>=0.
|
7 |
-
httpx>=0.21.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
requests>=2.26.0
|
3 |
pandas>=1.3.5
|
4 |
+
folium>=0.14.0
|
5 |
streamlit-folium>=0.4.0
|
6 |
+
python-dotenv>=1.0.0
|
7 |
+
httpx>=0.21.1
|
8 |
+
langchain
|
9 |
+
dotenv
|
10 |
+
openai
|
11 |
+
folium
|
12 |
+
google-generativeai
|
13 |
+
geopandas>=0.13.2
|
14 |
+
tiktoken
|
15 |
+
duckduckgo-search
|