adeelshuaib commited on
Commit
413cde5
·
verified ·
1 Parent(s): 1ed6933

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -1,8 +1,16 @@
1
  import gradio as gr
2
  from groq import Groq
 
 
 
 
 
 
 
 
3
 
4
  # Initialize Groq client
5
- client = Groq(api_key='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')
6
 
7
  # Function to generate responses with error handling
8
  def generate_response(user_input, chat_history):
 
1
  import gradio as gr
2
  from groq import Groq
3
+ from dotenv import load_dotenv
4
+ import os
5
+
6
+ # Load environment variables from .env file
7
+ load_dotenv()
8
+
9
+ # Access the API key
10
+ api_key = os.getenv("MY_API_KEY")
11
 
12
  # Initialize Groq client
13
+ client = Groq(api_key=api_key)
14
 
15
  # Function to generate responses with error handling
16
  def generate_response(user_input, chat_history):