saherPervaiz commited on
Commit
2745b9c
·
verified ·
1 Parent(s): ba32f5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
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 GROC API Key directly in the code
7
- GROC_API_KEY = os.getenv("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") # Make sure your API key is stored in the environment variable
 
 
 
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 {GROC_API_KEY}"}
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)