Spaces:
Sleeping
Sleeping
Jonas Wiesli
commited on
Commit
•
5f09f43
1
Parent(s):
c35fe56
added theme
Browse files
app.py
CHANGED
@@ -2,6 +2,20 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import openai
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
openai.api_key = "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"
|
6 |
|
7 |
with gr.Blocks() as iface:
|
@@ -60,21 +74,21 @@ with gr.Blocks() as iface:
|
|
60 |
chatbot.append(gr.Chatbot(label=roles[i]))
|
61 |
msg.append(gr.Textbox(label=""))
|
62 |
with gr.Column(scale=3):
|
63 |
-
characterImage = gr.Label(label="")
|
64 |
i += 1
|
65 |
|
66 |
-
with gr.Row(visible=False) as mapRow:
|
67 |
with gr.Column():
|
68 |
-
closeMapButton = gr.Button("X")
|
69 |
|
70 |
-
with gr.Row(visible=False) as solvingRow:
|
71 |
i = 0
|
72 |
while i < len(roles):
|
73 |
with gr.Column():
|
74 |
accusationButtons.append(gr.Button(roles[i]))
|
75 |
i += 1
|
76 |
|
77 |
-
closeSolvingButton = gr.Button("X")
|
78 |
|
79 |
with gr.Row(visible=False) as resultRow:
|
80 |
with gr.Column():
|
@@ -112,10 +126,10 @@ with gr.Blocks() as iface:
|
|
112 |
|
113 |
def generateAIMessage(history, questionCounterText, characterId):
|
114 |
if checkIfQuestionsLeft(questionCounterText):
|
|
|
|
|
115 |
message_history = [
|
116 |
-
{"role": "system", "content":
|
117 |
-
"reveal all of the information in a single "
|
118 |
-
"message, and leave hints. "}
|
119 |
]
|
120 |
for pair in history:
|
121 |
message_history.append({"role": "user", "content": pair[0]})
|
@@ -158,7 +172,6 @@ with gr.Blocks() as iface:
|
|
158 |
def declareVictory():
|
159 |
return "Congratulations, you found the killer! "
|
160 |
|
161 |
-
# again, ugly workaround
|
162 |
botfunctions = [bot0, bot1, bot2, bot3, bot4]
|
163 |
i = 0
|
164 |
while i < len(roles):
|
|
|
2 |
import os
|
3 |
import openai
|
4 |
|
5 |
+
theme = gr.themes.Monochrome(
|
6 |
+
primary_hue="purple",
|
7 |
+
secondary_hue="indigo",
|
8 |
+
text_size="text_lg",
|
9 |
+
radius_size="radius_sm",
|
10 |
+
font=[gr.themes.GoogleFont('Silkscreen'), 'ui-sans-serif', 'system-ui', 'sans-serif'],
|
11 |
+
).set(
|
12 |
+
body_background_fill='*primary_100',
|
13 |
+
body_background_fill_dark='*primary_950',
|
14 |
+
body_text_color='*neutral_800',
|
15 |
+
body_text_color_subdued='*primary_100',
|
16 |
+
background_fill_primary='*secondary_900'
|
17 |
+
)
|
18 |
+
|
19 |
openai.api_key = "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"
|
20 |
|
21 |
with gr.Blocks() as iface:
|
|
|
74 |
chatbot.append(gr.Chatbot(label=roles[i]))
|
75 |
msg.append(gr.Textbox(label=""))
|
76 |
with gr.Column(scale=3):
|
77 |
+
characterImage = gr.Label(label="", elem_classes="character-image-" + str(i))
|
78 |
i += 1
|
79 |
|
80 |
+
with gr.Row(visible=False, elem_classes="abs-window") as mapRow:
|
81 |
with gr.Column():
|
82 |
+
closeMapButton = gr.Button("X", elem_classes="close-button")
|
83 |
|
84 |
+
with gr.Row(visible=False, elem_classes="abs-window") as solvingRow:
|
85 |
i = 0
|
86 |
while i < len(roles):
|
87 |
with gr.Column():
|
88 |
accusationButtons.append(gr.Button(roles[i]))
|
89 |
i += 1
|
90 |
|
91 |
+
closeSolvingButton = gr.Button("X", elem_classes="close-button")
|
92 |
|
93 |
with gr.Row(visible=False) as resultRow:
|
94 |
with gr.Column():
|
|
|
126 |
|
127 |
def generateAIMessage(history, questionCounterText, characterId):
|
128 |
if checkIfQuestionsLeft(questionCounterText):
|
129 |
+
initSysMessage = initText[characterId] + "Stay in character. Use natural language. Don't reveal all of " \
|
130 |
+
"the information in a single message, and leave hints."
|
131 |
message_history = [
|
132 |
+
{"role": "system", "content": initSysMessage}
|
|
|
|
|
133 |
]
|
134 |
for pair in history:
|
135 |
message_history.append({"role": "user", "content": pair[0]})
|
|
|
172 |
def declareVictory():
|
173 |
return "Congratulations, you found the killer! "
|
174 |
|
|
|
175 |
botfunctions = [bot0, bot1, bot2, bot3, bot4]
|
176 |
i = 0
|
177 |
while i < len(roles):
|