Haofei Yu commited on
Commit
16ebb8e
1 Parent(s): 8cd6edd

change UI layout (#58)

Browse files

* update instruction

* change the layout

* change title

Files changed (1) hide show
  1. app.py +34 -22
app.py CHANGED
@@ -94,7 +94,15 @@ def introduction():
94
 
95
  ➡️️ **Intended Use**: Sotopia space is intended to showcase the social intelligence ability of different social agents in interesting social scenarios.
96
 
97
- ➡️ **Guidance**: Step (1) Select a social scenario that interests you; Step (2) select a social agent you want to chat with; Step (3) negotiate/debate/cooperate with the agents to see whether your goal or their social goal can be achieved.
 
 
 
 
 
 
 
 
98
 
99
  ⚠️ **Limitations**: The social agent can and will produce factually incorrect information, hallucinating facts and potentially offensive actions. It can produce problematic outputs, especially if prompted to do so.
100
 
@@ -170,7 +178,7 @@ def create_bot_goal(environment_dropdown):
170
  def sotopia_info_accordion(accordion_visible=True):
171
  environments, _, _, _ = get_sotopia_profiles()
172
 
173
- with gr.Accordion("Environment Configuration", open=accordion_visible):
174
  with gr.Row():
175
  environment_dropdown = gr.Dropdown(
176
  choices=environments,
@@ -184,35 +192,39 @@ def sotopia_info_accordion(accordion_visible=True):
184
  interactive=True,
185
  label="Model Selection"
186
  )
187
-
 
 
 
 
 
 
188
  scenario_info_display = create_environment_info(environment_dropdown.value)
189
 
190
  with gr.Row():
191
  bot_goal_display = create_bot_goal(environment_dropdown.value)
192
  user_goal_display = create_user_goal(environment_dropdown.value)
193
 
194
- with gr.Row():
195
- user_agent_dropdown = create_user_agent_dropdown(environment_dropdown.value)
196
- bot_agent_dropdown = create_bot_agent_dropdown(environment_dropdown.value, user_agent_dropdown.value)
197
 
198
  with gr.Row():
199
  user_agent_info_display = create_user_info(user_agent_dropdown.value)
200
  bot_agent_info_display = create_bot_info(bot_agent_dropdown.value)
201
 
202
- # Update user dropdown when scenario changes
203
- environment_dropdown.change(fn=create_user_agent_dropdown, inputs=[environment_dropdown], outputs=[user_agent_dropdown])
204
- # Update bot dropdown when user or scenario changes
205
- user_agent_dropdown.change(fn=create_bot_agent_dropdown, inputs=[environment_dropdown, user_agent_dropdown], outputs=[bot_agent_dropdown])
206
- # Update scenario information when scenario changes
207
- environment_dropdown.change(fn=create_environment_info, inputs=[environment_dropdown], outputs=[scenario_info_display])
208
- # Update user agent profile when user changes
209
- user_agent_dropdown.change(fn=create_user_info, inputs=[user_agent_dropdown], outputs=[user_agent_info_display])
210
- # Update bot agent profile when bot changes
211
- bot_agent_dropdown.change(fn=create_bot_info, inputs=[bot_agent_dropdown], outputs=[bot_agent_info_display])
212
- # Update user goal when scenario changes
213
- environment_dropdown.change(fn=create_user_goal, inputs=[environment_dropdown], outputs=[user_goal_display])
214
- # Update bot goal when scenario changes
215
- environment_dropdown.change(fn=create_bot_goal, inputs=[environment_dropdown], outputs=[bot_goal_display])
216
 
217
  return model_name_dropdown, environment_dropdown, user_agent_dropdown, bot_agent_dropdown
218
 
@@ -252,11 +264,11 @@ def chat_tab():
252
  return agent_action.to_natural_language()
253
 
254
  with gr.Column():
255
- with gr.Row():
256
  model_name_dropdown, scenario_dropdown, user_agent_dropdown, bot_agent_dropdown = sotopia_info_accordion()
257
 
258
  with gr.Column():
259
- with gr.Blocks():
260
  gr.ChatInterface(
261
  fn=run_chat,
262
  chatbot=gr.Chatbot(
 
94
 
95
  ➡️️ **Intended Use**: Sotopia space is intended to showcase the social intelligence ability of different social agents in interesting social scenarios.
96
 
97
+ **Guidance**:
98
+
99
+ Step (1) Select a social scenario that interests you in "Scenario Selection"
100
+
101
+ Step (2) Select a social agent you want to chat with in "Model Selection"
102
+
103
+ Step (3) Select which character you and your social agent will play in the scenario in "User Agent Selection" and "Bot Agent Selection"
104
+
105
+ Step (4) Negotiate/debate/cooperate with the social agent to see whether your goal or their social goal can be achieved.
106
 
107
  ⚠️ **Limitations**: The social agent can and will produce factually incorrect information, hallucinating facts and potentially offensive actions. It can produce problematic outputs, especially if prompted to do so.
108
 
 
178
  def sotopia_info_accordion(accordion_visible=True):
179
  environments, _, _, _ = get_sotopia_profiles()
180
 
181
+ with gr.Accordion("Create your sotopia space!", open=accordion_visible):
182
  with gr.Row():
183
  environment_dropdown = gr.Dropdown(
184
  choices=environments,
 
192
  interactive=True,
193
  label="Model Selection"
194
  )
195
+
196
+ with gr.Row():
197
+ user_agent_dropdown = create_user_agent_dropdown(environment_dropdown.value)
198
+ bot_agent_dropdown = create_bot_agent_dropdown(environment_dropdown.value, user_agent_dropdown.value)
199
+
200
+ with gr.Accordion("Check your social task!", open=accordion_visible):
201
+
202
  scenario_info_display = create_environment_info(environment_dropdown.value)
203
 
204
  with gr.Row():
205
  bot_goal_display = create_bot_goal(environment_dropdown.value)
206
  user_goal_display = create_user_goal(environment_dropdown.value)
207
 
208
+
 
 
209
 
210
  with gr.Row():
211
  user_agent_info_display = create_user_info(user_agent_dropdown.value)
212
  bot_agent_info_display = create_bot_info(bot_agent_dropdown.value)
213
 
214
+ # Update user dropdown when scenario changes
215
+ environment_dropdown.change(fn=create_user_agent_dropdown, inputs=[environment_dropdown], outputs=[user_agent_dropdown])
216
+ # Update bot dropdown when user or scenario changes
217
+ user_agent_dropdown.change(fn=create_bot_agent_dropdown, inputs=[environment_dropdown, user_agent_dropdown], outputs=[bot_agent_dropdown])
218
+ # Update scenario information when scenario changes
219
+ environment_dropdown.change(fn=create_environment_info, inputs=[environment_dropdown], outputs=[scenario_info_display])
220
+ # Update user agent profile when user changes
221
+ user_agent_dropdown.change(fn=create_user_info, inputs=[user_agent_dropdown], outputs=[user_agent_info_display])
222
+ # Update bot agent profile when bot changes
223
+ bot_agent_dropdown.change(fn=create_bot_info, inputs=[bot_agent_dropdown], outputs=[bot_agent_info_display])
224
+ # Update user goal when scenario changes
225
+ environment_dropdown.change(fn=create_user_goal, inputs=[environment_dropdown], outputs=[user_goal_display])
226
+ # Update bot goal when scenario changes
227
+ environment_dropdown.change(fn=create_bot_goal, inputs=[environment_dropdown], outputs=[bot_goal_display])
228
 
229
  return model_name_dropdown, environment_dropdown, user_agent_dropdown, bot_agent_dropdown
230
 
 
264
  return agent_action.to_natural_language()
265
 
266
  with gr.Column():
267
+ with gr.Blocks():
268
  model_name_dropdown, scenario_dropdown, user_agent_dropdown, bot_agent_dropdown = sotopia_info_accordion()
269
 
270
  with gr.Column():
271
+ with gr.Accordion("Start the conversation to achieve your goal!", open=True):
272
  gr.ChatInterface(
273
  fn=run_chat,
274
  chatbot=gr.Chatbot(