abdullahzunorain
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,19 @@
|
|
1 |
import requests
|
2 |
import streamlit as st
|
3 |
import groq
|
|
|
4 |
|
5 |
# Function to get weather data from OpenWeatherMap
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def get_weather_data(city):
|
7 |
-
api_key =
|
8 |
url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
|
9 |
try:
|
10 |
response = requests.get(url)
|
@@ -26,7 +35,7 @@ def parse_weather_data(weather_data):
|
|
26 |
def get_outfit_suggestion(temperature, description, style, fabric):
|
27 |
# Initialize Groq's API
|
28 |
try:
|
29 |
-
client = groq.Groq(api_key=
|
30 |
|
31 |
prompt = f"The current weather is {description} with a temperature of {temperature}°C. Suggest an outfit. The user prefers a {style} style and {fabric} fabric."
|
32 |
|
|
|
1 |
import requests
|
2 |
import streamlit as st
|
3 |
import groq
|
4 |
+
import os
|
5 |
|
6 |
# Function to get weather data from OpenWeatherMap
|
7 |
+
|
8 |
+
import os
|
9 |
+
|
10 |
+
# Replace with environment variables
|
11 |
+
openweather_api_key = os.getenv("weather_api_key")
|
12 |
+
groq_api_key = os.getenv("groq_api_key")
|
13 |
+
|
14 |
+
|
15 |
def get_weather_data(city):
|
16 |
+
api_key = openweather_api_key # Replace with your OpenWeatherMap API key
|
17 |
url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
|
18 |
try:
|
19 |
response = requests.get(url)
|
|
|
35 |
def get_outfit_suggestion(temperature, description, style, fabric):
|
36 |
# Initialize Groq's API
|
37 |
try:
|
38 |
+
client = groq.Groq(api_key=groq_api_key) # Replace with your Groq API key
|
39 |
|
40 |
prompt = f"The current weather is {description} with a temperature of {temperature}°C. Suggest an outfit. The user prefers a {style} style and {fabric} fabric."
|
41 |
|