Spaces:
Sleeping
Sleeping
Jonas Wiesli
commited on
Commit
•
96e77e9
1
Parent(s):
343724c
repositioned function in file
Browse files
app.py
CHANGED
@@ -19,40 +19,40 @@ with gr.Blocks() as iface:
|
|
19 |
return history
|
20 |
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
23 |
bot, chatbot, chatbot
|
24 |
)
|
25 |
|
26 |
-
iface.launch()
|
27 |
-
|
28 |
-
|
29 |
-
def generateAIMessage(history):
|
30 |
-
message_history = [
|
31 |
-
{"role": "system", "content": "You are Steve Binner, 31, a security guard for a museum of medieval "
|
32 |
-
"history. You're absolutely sure that this place is haunted. Before the "
|
33 |
-
"spooky stuff started, you were really happy with your job, "
|
34 |
-
"but that changed real fast. The ghost is a french nobleman named Hugo "
|
35 |
-
"Antoine the Third. You've been trying to tell other people about this, "
|
36 |
-
"but you've only been laughed at so far. But you've got evidence! Every "
|
37 |
-
"night, around 10pm, the broom closet gets locked from the inside and the "
|
38 |
-
"interior gets wrecked. We're talking pushed over tables, "
|
39 |
-
"broken containers, the whole shebang. When it comes to the murder of "
|
40 |
-
"director Eisenholz last thursday, that has to have been the ghost, "
|
41 |
-
"no question. You even have the door card records for the room he was in: "
|
42 |
-
"After the museum closed at 5pm, nobody entered that room till the next "
|
43 |
-
"morning. Now you're being interrogated by a detective. You don't use "
|
44 |
-
"uptight language, and you're not super well educated on most stuff, "
|
45 |
-
"but when it comes to the paranormal, you're an ace. Stay in character. Use "
|
46 |
-
"natural language. Don't reveal all of the information in a single message, "
|
47 |
-
"and leave hints. "}
|
48 |
-
]
|
49 |
-
for pair in history:
|
50 |
-
message_history.append({"role": "user", "content": pair[0]})
|
51 |
-
print()
|
52 |
-
if pair[1] is not None:
|
53 |
-
message_history.append({"assistant": "user", "content": pair[1]})
|
54 |
-
completion = openai.ChatCompletion.create(
|
55 |
-
model="gpt-3.5-turbo",
|
56 |
-
messages=message_history
|
57 |
-
)
|
58 |
-
return completion.choices[0].message.content
|
|
|
19 |
return history
|
20 |
|
21 |
|
22 |
+
def generateAIMessage(history):
|
23 |
+
message_history = [
|
24 |
+
{"role": "system", "content": "You are Steve Binner, 31, a security guard for a museum of medieval "
|
25 |
+
"history. You're absolutely sure that this place is haunted. Before the "
|
26 |
+
"spooky stuff started, you were really happy with your job, "
|
27 |
+
"but that changed real fast. The ghost is a french nobleman named Hugo "
|
28 |
+
"Antoine the Third. You've been trying to tell other people about this, "
|
29 |
+
"but you've only been laughed at so far. But you've got evidence! Every "
|
30 |
+
"night, around 10pm, the broom closet gets locked from the inside and the "
|
31 |
+
"interior gets wrecked. We're talking pushed over tables, "
|
32 |
+
"broken containers, the whole shebang. When it comes to the murder of "
|
33 |
+
"director Eisenholz last thursday, that has to have been the ghost, "
|
34 |
+
"no question. You even have the door card records for the room he was in: "
|
35 |
+
"After the museum closed at 5pm, nobody entered that room till the next "
|
36 |
+
"morning. Now you're being interrogated by a detective. You don't use "
|
37 |
+
"uptight language, and you're not super well educated on most stuff, "
|
38 |
+
"but when it comes to the paranormal, you're an ace. Stay in character. Use "
|
39 |
+
"natural language. Don't reveal all of the information in a single message, "
|
40 |
+
"and leave hints. "}
|
41 |
+
]
|
42 |
+
for pair in history:
|
43 |
+
message_history.append({"role": "user", "content": pair[0]})
|
44 |
+
print()
|
45 |
+
if pair[1] is not None:
|
46 |
+
message_history.append({"assistant": "user", "content": pair[1]})
|
47 |
+
completion = openai.ChatCompletion.create(
|
48 |
+
model="gpt-3.5-turbo",
|
49 |
+
messages=message_history
|
50 |
+
)
|
51 |
+
return completion.choices[0].message.content
|
52 |
+
|
53 |
+
|
54 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
55 |
bot, chatbot, chatbot
|
56 |
)
|
57 |
|
58 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|