saherPervaiz commited on
Commit
9599e52
·
verified ·
1 Parent(s): 29f1863

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -1,14 +1,14 @@
1
  import streamlit as st
2
  import pandas as pd
3
  import requests
4
- import os
5
  from groq import Groq
 
6
 
7
- from google.colab import userdata
8
- api=userdata.get('demo')
9
 
10
- # Initialize the Groq client
11
- client = Groq(api_key=api)
12
 
13
  # Function to load and preprocess data
14
  @st.cache_data
@@ -44,10 +44,8 @@ def provide_observed_advice(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)
 
1
  import streamlit as st
2
  import pandas as pd
3
  import requests
 
4
  from groq import Groq
5
+ import os
6
 
7
+ # Set the API key directly or from environment variable
8
+ api_key = "demo_gsk_Rz0lqhPxsrsKCbR12FTeWGdyb3FYh1QKoZV8Q0SD1pSUMqEEvVHf" # Replace with your actual demo API key
9
 
10
+ # Initialize the Groq client with the API key
11
+ client = Groq(api_key=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
  url = f"https://api.groc.com/search?q={query}"
48
+ headers = {"Authorization": f"Bearer {api_key}"} # Use the demo API key in the header
49
 
50
  try:
51
  response = requests.get(url, headers=headers)