youngtsai commited on
Commit
b504c70
·
verified ·
1 Parent(s): c8b8d60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -8,8 +8,8 @@ except ImportError:
8
  os.system('pip install groq')
9
  from groq import Groq
10
 
11
- # 設定環境變數
12
- os.environ["GROQ_API_KEY"] = os.getenv("groq_key") # 確保這個環境變數已設置
13
 
14
  # 初始化 Groq 客戶端
15
  client = Groq()
@@ -44,8 +44,8 @@ def chat_with_groq(user_input):
44
  # 使用 Gradio 創建 chatbot
45
  iface = gr.Interface(
46
  fn=chat_with_groq,
47
- inputs=gr.inputs.Textbox(label="請輸入您的問題:"),
48
- outputs=gr.outputs.Textbox(label="回應:"),
49
  title="國文老師 Chatbot",
50
  description="這是一個專門批改國小作文的 Chatbot"
51
  )
 
8
  os.system('pip install groq')
9
  from groq import Groq
10
 
11
+ # 設置 GROQ_API_KEY 環境變數
12
+ os.environ["GROQ_API_KEY"] = os.getenv("groq_key")
13
 
14
  # 初始化 Groq 客戶端
15
  client = Groq()
 
44
  # 使用 Gradio 創建 chatbot
45
  iface = gr.Interface(
46
  fn=chat_with_groq,
47
+ inputs=gr.Textbox(label="請輸入您的問題:"), # 更新為新版 Gradio 語法
48
+ outputs=gr.Textbox(label="回應:"), # 更新為新版 Gradio 語法
49
  title="國文老師 Chatbot",
50
  description="這是一個專門批改國小作文的 Chatbot"
51
  )