Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
import gradio as gr
|
|
|
|
|
5 |
|
6 |
-
# Set up the API key
|
7 |
-
api_key =
|
8 |
|
|
|
|
|
|
|
9 |
|
10 |
# Initialize the client
|
11 |
-
client = Groq(api_key=
|
12 |
|
13 |
# Function to interact with the Groq API
|
14 |
def chat_with_groq(user_input):
|
@@ -36,5 +38,5 @@ interface = gr.Interface(
|
|
36 |
)
|
37 |
|
38 |
# Launch the interface
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
+
from some_groq_client_library import Groq # Replace with the actual Groq client library
|
4 |
|
5 |
+
# Set up the API key from environment variables
|
6 |
+
api_key = os.getenv("GROQ_API_KEY")
|
7 |
|
8 |
+
# Ensure the API key is provided
|
9 |
+
if not api_key:
|
10 |
+
raise ValueError("GROQ_API_KEY environment variable is not set.")
|
11 |
|
12 |
# Initialize the client
|
13 |
+
client = Groq(api_key=api_key)
|
14 |
|
15 |
# Function to interact with the Groq API
|
16 |
def chat_with_groq(user_input):
|
|
|
38 |
)
|
39 |
|
40 |
# Launch the interface
|
41 |
+
if __name__ == "__main__":
|
42 |
+
interface.launch()
|