AUST001 commited on
Commit
0936cf0
·
1 Parent(s): f6e601b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -29,7 +29,8 @@ def generate_image_url(prompt):
29
  image_url = response["data"][0]["url"]
30
  return image_url
31
 
32
- def greet(user_id, user_question, clear_history):
 
33
  global user_contexts
34
  if user_id not in user_contexts:
35
  user_contexts[user_id] = [
@@ -70,6 +71,7 @@ demo = gr.Interface(
70
  fn=greet,
71
  inputs=[
72
  gr.Textbox(lines=1, label='请输入用户ID', placeholder='请输入用户ID'),
 
73
  gr.Textbox(lines=15, label='请输入问题', placeholder='请输入您的问题'),
74
  gr.Checkbox(label='清空聊天记录', default=False)
75
  ],
 
29
  image_url = response["data"][0]["url"]
30
  return image_url
31
 
32
+ def greet(user_id, user_question, api_key, clear_history):
33
+ openai.api_key = api_key
34
  global user_contexts
35
  if user_id not in user_contexts:
36
  user_contexts[user_id] = [
 
71
  fn=greet,
72
  inputs=[
73
  gr.Textbox(lines=1, label='请输入用户ID', placeholder='请输入用户ID'),
74
+ gr.Textbox(lines=1, label='请输入你的OpenAI API密钥', placeholder='请输入你的OpenAI API密钥'),
75
  gr.Textbox(lines=15, label='请输入问题', placeholder='请输入您的问题'),
76
  gr.Checkbox(label='清空聊天记录', default=False)
77
  ],