Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Set up the Groq client with the secret key
|
| 6 |
groq_key = os.getenv('groq_key')
|
|
|
|
|
|
|
|
|
|
| 7 |
client = Groq(api_key=groq_key)
|
| 8 |
|
| 9 |
class SimpleChatBot:
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
+
|
| 4 |
+
# Install the groq package if it is not installed
|
| 5 |
+
try:
|
| 6 |
+
from groq import Groq
|
| 7 |
+
except ImportError:
|
| 8 |
+
os.system('pip install groq')
|
| 9 |
+
from groq import Groq
|
| 10 |
|
| 11 |
# Set up the Groq client with the secret key
|
| 12 |
groq_key = os.getenv('groq_key')
|
| 13 |
+
if not groq_key:
|
| 14 |
+
raise ValueError("groq_key environment variable is not set")
|
| 15 |
+
|
| 16 |
client = Groq(api_key=groq_key)
|
| 17 |
|
| 18 |
class SimpleChatBot:
|