Dua Rajper commited on
Commit
c903175
·
verified ·
1 Parent(s): fff0980

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -1,11 +1,16 @@
1
  import os
2
  import streamlit as st
3
  from groq import Groq
 
4
 
5
- # Set up the API key
 
 
 
6
  GROQ_API_KEY = os.getenv("GROQ_API_KEY")
 
7
  if not GROQ_API_KEY:
8
- st.error("Please set the GROQ_API_KEY as an environment variable.")
9
  st.stop()
10
 
11
  # Initialize Groq client
 
1
  import os
2
  import streamlit as st
3
  from groq import Groq
4
+ from dotenv import load_dotenv
5
 
6
+ # Load .env file
7
+ load_dotenv()
8
+
9
+ # Fetch API key
10
  GROQ_API_KEY = os.getenv("GROQ_API_KEY")
11
+
12
  if not GROQ_API_KEY:
13
+ st.error("Please set the GROQ_API_KEY in the .env file and restart the app.")
14
  st.stop()
15
 
16
  # Initialize Groq client