Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,22 +14,20 @@ restart_sequence = "\nHuman: "
|
|
14 |
|
15 |
def predict(input,initial_prompt, history=[]):
|
16 |
|
17 |
-
s = list(sum(history, ()))
|
18 |
-
s.append(input)
|
19 |
-
# initial_prompt="The following is a conversation with an AI movie recommendation assistant. The assistant is helpful, creative, clever, and very friendly.Along with movie recommendation it also talks about general topics"
|
20 |
-
# \n\nHuman: Hello, who are you?\nAI: I am an AI created by OpenAI. How can I help you today?\nHuman: "
|
21 |
response = openai.Completion.create(
|
22 |
model="text-davinci-003",
|
23 |
-
prompt= initial_prompt + "\n" + str(s),
|
|
|
24 |
temperature=0.9,
|
25 |
max_tokens=150,
|
26 |
top_p=1,
|
27 |
frequency_penalty=0,
|
28 |
-
presence_penalty=0.6
|
29 |
-
stop=[" Human:", " AI:"])
|
30 |
# tokenize the new input sentence
|
31 |
-
|
32 |
-
history.append((input,
|
33 |
|
34 |
return history, history
|
35 |
|
|
|
14 |
|
15 |
def predict(input,initial_prompt, history=[]):
|
16 |
|
17 |
+
#s = list(sum(history, ()))
|
18 |
+
#s.append(input)
|
|
|
|
|
19 |
response = openai.Completion.create(
|
20 |
model="text-davinci-003",
|
21 |
+
#prompt= initial_prompt + "\n" + str(s),
|
22 |
+
prompt=input,
|
23 |
temperature=0.9,
|
24 |
max_tokens=150,
|
25 |
top_p=1,
|
26 |
frequency_penalty=0,
|
27 |
+
presence_penalty=0.6)
|
|
|
28 |
# tokenize the new input sentence
|
29 |
+
responseText = response["choices"][0]["text"]
|
30 |
+
history.append((input, responseText))
|
31 |
|
32 |
return history, history
|
33 |
|