iskoldt-X commited on
Commit
368e07a
1 Parent(s): db702ce

Adapt to run in Docker

Browse files
Files changed (1) hide show
  1. ChuanhuChatbot.py +11 -3
ChuanhuChatbot.py CHANGED
@@ -1,12 +1,20 @@
1
  import gradio as gr
2
  import openai
 
 
3
  # import markdown
4
 
5
-
6
- 我的API密钥 = "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # 在这里输入你的 API 密钥
7
  initial_prompt = "You are a helpful assistant."
8
 
9
- openai.api_key = 我的API密钥
 
 
 
 
 
 
 
10
 
11
  def parse_text(text):
12
  lines = text.split("\n")
 
1
  import gradio as gr
2
  import openai
3
+ import os
4
+ import sys
5
  # import markdown
6
 
7
+ my_api_key = "" # 在这里输入你的 API 密钥
 
8
  initial_prompt = "You are a helpful assistant."
9
 
10
+ if my_api_key == "":
11
+ my_api_key = os.environ.get('my_api_key')
12
+
13
+ if my_api_key == "empty":
14
+ print("Please give a api key!")
15
+ sys.exit(1)
16
+
17
+ openai.api_key = my_api_key
18
 
19
  def parse_text(text):
20
  lines = text.split("\n")