Spaces:
Runtime error
Runtime error
peterchuang
commited on
Commit
•
0bc9e7d
1
Parent(s):
06cb7ca
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
-
from groq import Groq
|
4 |
-
from gradio import ChatMessage
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
# 從環境變數中獲取 API 密鑰
|
7 |
api_key = os.getenv("groq_key")
|
8 |
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
|
|
|
|
3 |
|
4 |
+
from gradio import ChatMessage
|
5 |
+
try:
|
6 |
+
from groq import Groq
|
7 |
+
except ImportError:
|
8 |
+
os.system('pip install groq')
|
9 |
+
from groq import Groq
|
10 |
# 從環境變數中獲取 API 密鑰
|
11 |
api_key = os.getenv("groq_key")
|
12 |
|