peterchuang commited on
Commit
04f2f04
1 Parent(s): 992901b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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