tommy24 commited on
Commit
80d09b8
·
1 Parent(s): f04358a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -45,7 +45,7 @@ import requests
45
  import openai
46
  import os
47
 
48
- def function(Textbox,Textbox2,Textbox3):
49
  target = os.environ.get("target")
50
  target2 = os.environ.get("target2")
51
  openai.api_key = target2
@@ -56,13 +56,12 @@ def function(Textbox,Textbox2,Textbox3):
56
  messages = [
57
  {"role": "system", "content": content},
58
  ]
59
- if Textbox2:
60
- messages.append(
61
- {"role": "user", "content": Textbox},
62
- )
63
- chat = openai.ChatCompletion.create(
64
- model="gpt-3.5-turbo", messages=messages
65
- )
66
  reply = chat.choices[0].message.content
67
  messages.append({"role": "assistant", "content": reply})
68
  return reply
@@ -71,7 +70,7 @@ def function(Textbox,Textbox2,Textbox3):
71
 
72
  inputs = [
73
  gr.inputs.Textbox(label="Textbox",type="text"),
74
- gr.inputs.Textbox(label="Textbox2",type="text"),
75
  gr.inputs.Textbox(label="Textbox3",type="password")
76
  ]
77
 
 
45
  import openai
46
  import os
47
 
48
+ def function(Textbox,Textbox3):
49
  target = os.environ.get("target")
50
  target2 = os.environ.get("target2")
51
  openai.api_key = target2
 
56
  messages = [
57
  {"role": "system", "content": content},
58
  ]
59
+ messages.append(
60
+ {"role": "user", "content": Textbox},
61
+ )
62
+ chat = openai.ChatCompletion.create(
63
+ model="gpt-3.5-turbo", messages=messages
64
+ )
 
65
  reply = chat.choices[0].message.content
66
  messages.append({"role": "assistant", "content": reply})
67
  return reply
 
70
 
71
  inputs = [
72
  gr.inputs.Textbox(label="Textbox",type="text"),
73
+ # gr.inputs.Textbox(label="Textbox2",type="text"),
74
  gr.inputs.Textbox(label="Textbox3",type="password")
75
  ]
76