Spaces:
Runtime error
Runtime error
Haofei Yu
commited on
Commit
•
2600030
1
Parent(s):
33a0edf
fix imgs and typos (#26)
Browse files- app.py +10 -10
- images/bot_icon.png +0 -0
- images/profile1.jpg +0 -0
- images/profile2.jpg +0 -0
- images/sotopia.jpeg +0 -0
- images/sotopia.jpg +0 -0
- images/user_icon.png +0 -0
- utils.py +1 -1
app.py
CHANGED
@@ -48,10 +48,10 @@ def prepare():
|
|
48 |
|
49 |
def introduction():
|
50 |
with gr.Column(scale=2):
|
51 |
-
gr.Image("images/sotopia.
|
52 |
with gr.Column(scale=5):
|
53 |
gr.Markdown(
|
54 |
-
"""# Sotopia-Pi Demo
|
55 |
**Chat with [Sotopia-Pi](https://github.com/sotopia-lab/sotopia-pi), brainstorm ideas, discuss your holiday plans, and more!**
|
56 |
|
57 |
➡️️ **Intended Use**: this demo is intended to showcase an early finetuning of [sotopia-pi-mistral-7b-BC_SR](https://huggingface.co/cmu-lti/sotopia-pi-mistral-7b-BC_SR)/
|
@@ -65,7 +65,6 @@ def introduction():
|
|
65 |
|
66 |
|
67 |
def param_accordion(according_visible=True):
|
68 |
-
|
69 |
with gr.Accordion("Parameters", open=False, visible=according_visible):
|
70 |
temperature = gr.Slider(
|
71 |
minimum=0.1,
|
@@ -87,29 +86,30 @@ def param_accordion(according_visible=True):
|
|
87 |
value=uuid4,
|
88 |
interactive=False,
|
89 |
visible=False,
|
|
|
90 |
)
|
91 |
return temperature, session_id, max_tokens
|
92 |
|
93 |
|
94 |
def sotopia_info_accordion(human_agent, machine_agent, scenario, according_visible=True):
|
95 |
-
with gr.Accordion("
|
96 |
with gr.Row():
|
97 |
with gr.Column():
|
98 |
user_name = gr.Textbox(
|
99 |
lines=1,
|
100 |
label="username",
|
101 |
-
value=human_agent,
|
102 |
interactive=True,
|
103 |
-
placeholder="
|
104 |
show_label=False,
|
105 |
max_lines=1,
|
106 |
)
|
107 |
with gr.Column():
|
108 |
bot_name = gr.Textbox(
|
109 |
lines=1,
|
110 |
-
value=machine_agent,
|
111 |
interactive=True,
|
112 |
-
placeholder="
|
113 |
show_label=False,
|
114 |
max_lines=1,
|
115 |
visible=False,
|
@@ -226,8 +226,8 @@ def chat_tab():
|
|
226 |
show_label=False,
|
227 |
rtl=False,
|
228 |
avatar_images=(
|
229 |
-
"images/
|
230 |
-
"images/
|
231 |
),
|
232 |
),
|
233 |
textbox=gr.Textbox(
|
|
|
48 |
|
49 |
def introduction():
|
50 |
with gr.Column(scale=2):
|
51 |
+
gr.Image("images/sotopia.jpg", elem_id="banner-image", show_label=False)
|
52 |
with gr.Column(scale=5):
|
53 |
gr.Markdown(
|
54 |
+
"""# Sotopia-Pi Demo
|
55 |
**Chat with [Sotopia-Pi](https://github.com/sotopia-lab/sotopia-pi), brainstorm ideas, discuss your holiday plans, and more!**
|
56 |
|
57 |
➡️️ **Intended Use**: this demo is intended to showcase an early finetuning of [sotopia-pi-mistral-7b-BC_SR](https://huggingface.co/cmu-lti/sotopia-pi-mistral-7b-BC_SR)/
|
|
|
65 |
|
66 |
|
67 |
def param_accordion(according_visible=True):
|
|
|
68 |
with gr.Accordion("Parameters", open=False, visible=according_visible):
|
69 |
temperature = gr.Slider(
|
70 |
minimum=0.1,
|
|
|
86 |
value=uuid4,
|
87 |
interactive=False,
|
88 |
visible=False,
|
89 |
+
label="Session ID",
|
90 |
)
|
91 |
return temperature, session_id, max_tokens
|
92 |
|
93 |
|
94 |
def sotopia_info_accordion(human_agent, machine_agent, scenario, according_visible=True):
|
95 |
+
with gr.Accordion("Sotopia Information", open=False, visible=according_visible):
|
96 |
with gr.Row():
|
97 |
with gr.Column():
|
98 |
user_name = gr.Textbox(
|
99 |
lines=1,
|
100 |
label="username",
|
101 |
+
value=human_agent.name,
|
102 |
interactive=True,
|
103 |
+
placeholder=f"{human_agent.name}: ",
|
104 |
show_label=False,
|
105 |
max_lines=1,
|
106 |
)
|
107 |
with gr.Column():
|
108 |
bot_name = gr.Textbox(
|
109 |
lines=1,
|
110 |
+
value=machine_agent.name,
|
111 |
interactive=True,
|
112 |
+
placeholder=f"{bot_agent.name}: ",
|
113 |
show_label=False,
|
114 |
max_lines=1,
|
115 |
visible=False,
|
|
|
226 |
show_label=False,
|
227 |
rtl=False,
|
228 |
avatar_images=(
|
229 |
+
"images/profile1.jpg",
|
230 |
+
"images/profile2.jpg"
|
231 |
),
|
232 |
),
|
233 |
textbox=gr.Textbox(
|
images/bot_icon.png
DELETED
Binary file (13.7 kB)
|
|
images/profile1.jpg
ADDED
images/profile2.jpg
ADDED
images/sotopia.jpeg
DELETED
Binary file (9.18 kB)
|
|
images/sotopia.jpg
ADDED
images/user_icon.png
DELETED
Binary file (21.3 kB)
|
|
utils.py
CHANGED
@@ -9,7 +9,7 @@ class Agent:
|
|
9 |
self.personality = personality
|
10 |
|
11 |
def get_starter_prompt(machine_agent, human_agent, scenario):
|
12 |
-
return f"Prompt after formatting:\nImagine you are {machine_agent.name}, your task is to act/speak as {machine_agent.name} would, keeping in mind {machine_agent.name}'s social goal.\nYou can find {machine_agent.name}'s background and goal in the 'Here is the context of the interaction' field.\nNote that {machine_agent.name}'s secret and goal is only visible to you.\nYou should try your best to achieve {machine_agent.name}'s goal in a way that align with their character traits.\nAdditionally, maintaining the conversation's naturalness and realism is essential (e.g., do not repeat what other people has already said before).\n\nHere is the context of this interaction:\n Scenario: {scenario}\nParticipants: {human_agent.name} and {machine_agent.name}\n{human_agent.name}'s background: {human_agent.background} Personality and values description: {human_agent.personality} \n{machine_agent.name}'s background: {machine_agent.background} Personality and values description: {machine_agent.personality} {machine_agent.name}'s secrets: {machine_agent.secrets}\n{human_agent.name}'s goal: Unknown\n{machine_agent.name}'s goal: {machine_agent.
|
13 |
|
14 |
# we define history as
|
15 |
# [(user_message, bot_message), (user_message, bot_message)]
|
|
|
9 |
self.personality = personality
|
10 |
|
11 |
def get_starter_prompt(machine_agent, human_agent, scenario):
|
12 |
+
return f"Prompt after formatting:\nImagine you are {machine_agent.name}, your task is to act/speak as {machine_agent.name} would, keeping in mind {machine_agent.name}'s social goal.\nYou can find {machine_agent.name}'s background and goal in the 'Here is the context of the interaction' field.\nNote that {machine_agent.name}'s secret and goal is only visible to you.\nYou should try your best to achieve {machine_agent.name}'s goal in a way that align with their character traits.\nAdditionally, maintaining the conversation's naturalness and realism is essential (e.g., do not repeat what other people has already said before).\n\nHere is the context of this interaction:\n Scenario: {scenario}\nParticipants: {human_agent.name} and {machine_agent.name}\n{human_agent.name}'s background: {human_agent.background} Personality and values description: {human_agent.personality} \n{machine_agent.name}'s background: {machine_agent.background} Personality and values description: {machine_agent.personality} {machine_agent.name}'s secrets: {machine_agent.secrets}\n{human_agent.name}'s goal: Unknown\n{machine_agent.name}'s goal: {machine_agent.goal}\nConversation Starts:"
|
13 |
|
14 |
# we define history as
|
15 |
# [(user_message, bot_message), (user_message, bot_message)]
|