Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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=
|
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):
|