Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,13 @@ import streamlit as st
|
|
2 |
import pandas as pd
|
3 |
import requests
|
4 |
import os
|
|
|
5 |
|
6 |
-
# Set the
|
7 |
-
|
|
|
|
|
|
|
8 |
|
9 |
# Function to load and preprocess data
|
10 |
@st.cache_data
|
@@ -40,8 +44,10 @@ def provide_observed_advice(data):
|
|
40 |
|
41 |
# Function to fetch health articles from the GROC API based on the query
|
42 |
def get_health_articles(query):
|
|
|
|
|
43 |
url = f"https://api.groc.com/search?q={query}"
|
44 |
-
headers = {"Authorization": f"Bearer {
|
45 |
|
46 |
try:
|
47 |
response = requests.get(url, headers=headers)
|
|
|
2 |
import pandas as pd
|
3 |
import requests
|
4 |
import os
|
5 |
+
from groq import Groq
|
6 |
|
7 |
+
# Set the Groq API Key directly in the code
|
8 |
+
GROQ_API_KEY = os.getenv("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") # Make sure your API key is stored in the environment variable
|
9 |
+
|
10 |
+
# Initialize the Groq client
|
11 |
+
client = Groq(api_key=GROQ_API_KEY)
|
12 |
|
13 |
# Function to load and preprocess data
|
14 |
@st.cache_data
|
|
|
44 |
|
45 |
# Function to fetch health articles from the GROC API based on the query
|
46 |
def get_health_articles(query):
|
47 |
+
# Change this based on the new Groq API if needed,
|
48 |
+
# Assuming you're using an API that provides health articles (adjust the endpoint as needed)
|
49 |
url = f"https://api.groc.com/search?q={query}"
|
50 |
+
headers = {"Authorization": f"Bearer {GROQ_API_KEY}"}
|
51 |
|
52 |
try:
|
53 |
response = requests.get(url, headers=headers)
|