kwabs22 commited on
Commit
db5d6aa
·
1 Parent(s): b559984

Fixing Edit while play

Browse files
Files changed (1) hide show
  1. app.py +62 -60
app.py CHANGED
@@ -1055,35 +1055,35 @@ Creating more diverse paths through the game""")
1055
  gr.Code(json.dumps(experimetal_config, default=lambda o: o.__dict__, indent=2), label=experimetal_config_name) #str(experimetal_config)
1056
 
1057
  with gr.Tab("Test and Edit Config"):
1058
- with gr.Tab("Manual - Config Without Assets"):
1059
- with gr.Row():
1060
- with gr.Column(scale=2):
1061
- gr.Markdown("# Text-based Adventure Game")
1062
-
1063
- description = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
1064
- choices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
1065
- submit_btn = gr.Button("Make Choice")
1066
- game_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
1067
- game_session = gr.State(value=initgameinfo[3])
1068
- submit_btn.click(
1069
- make_choice,
1070
- inputs=[choices, game_session],
1071
- outputs=[description, choices, game_log, game_session]
1072
- )
1073
- with gr.Column(scale=1):
1074
- gr.Markdown("# Debugging")
1075
- error_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
1076
- with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
1077
- custom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
1078
- custom_configbtn = gr.Button("Load Custom Config")
1079
-
1080
- custom_configbtn.click(
1081
- load_game,
1082
- inputs=[custom_config],
1083
- outputs=[error_box, game_log, description, choices, game_session, custom_config]
1084
- )
1085
  with gr.Tab("Manual - Config With Assets"):
1086
- gr.HTML("Placeholder as not complete yet (still only text, current issue is how to switch gradio output, maybe output is gr.Group and we constantly add the appropriate gr for each file type? What about multi file types on one state?)")
1087
  with gr.Row():
1088
  with gr.Column(scale=2):
1089
  gr.Markdown("# Text-based Adventure Game")
@@ -1126,16 +1126,45 @@ Creating more diverse paths through the game""")
1126
  inputs=[wacustom_config, wamediabool],
1127
  outputs=[waerror_box, wagame_log, wadescription, wachoices, wacustom_config, wagame_session, wamedia]
1128
  )
1129
-
1130
- with gr.Tab("Manual - Config With Minimal 3D considered"):
1131
- gr.HTML("Placeholder for Config with 3D assets")
1132
 
1133
  with gr.Tab("Semi-Auto - Edit config while playing game"):
1134
- gr.HTML("-- Incomplete -- (also generate_story_and_timeline refactored) Issue here is updating all variables <br> Current problem is passing values from rendered items to the config box <br>Generate Timline also makes config without mmedia key <br>Need a way have dropdowns for the filelist and transitions eg. changing transitions must auto update choices <br>Config to components has hardcoded variables based on the auto gen so changes break it")
 
 
1135
  with gr.Column(scale=1):
1136
  gr.Markdown("# Debugging")
1137
  with gr.Row():
1138
- ewpwaerror_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1139
  ewpwacustom_config = gr.Textbox(label="Custom Configuration (JSON)", lines=4) #value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=4) #Commented out due to initial load issues
1140
  ewpwacustom_configbtn = gr.Button("Load Custom Config")
1141
 
@@ -1177,33 +1206,6 @@ Creating more diverse paths through the game""")
1177
  outputs=[ewpwaerror_box, ewpwagame_log, ewpwadescription, ewpwachoices, ewpwacustom_config, ewpwagame_session, ewpwamedia]
1178
  )
1179
  with gr.Column(scale=1):
1180
- with gr.Accordion("Generate a new config", open=False):
1181
- with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
1182
- gr.Markdown("# Story and Timeline Generator")
1183
- gr.Markdown("Click the button to generate a random timeline and story based on UI elements and story events. <br>Ask an LLM to use this to write a story around")
1184
- with gr.Row():
1185
- ewpgame_structure_output_text_with_media = gr.Code(language="json")
1186
- #ewpgame_structure_output_text = gr.Code(language="json")
1187
- with gr.Row():
1188
- ewptimeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
1189
- #ewptimeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
1190
- with gr.Column():
1191
- ewptimeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
1192
- ewptimeline_selected_lists_text = gr.Textbox(label="Selected Idea Lists for Inspiration", lines=2)
1193
- ewpstory_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
1194
- with gr.Row():
1195
- ewpgenerate_no_story_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of story timeline points")
1196
- ewpgenerate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
1197
- #ewpgenerate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
1198
- #ewpgenerate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
1199
- with gr.Row():
1200
- ewptimeline_num_lists_slider = gr.Slider(minimum=1, maximum=len(all_idea_lists), step=1, label="Number of Lists to Consider", value=3)
1201
- ewptimeline_items_per_list_slider = gr.Slider(minimum=1, maximum=10, step=1, label="Items per List", value=3)
1202
- ewptimeline_include_existing_games = gr.Checkbox(label="Include Existing Game Inspirations", value=True)
1203
- ewptimeline_include_multiplayer = gr.Checkbox(label="Include Multiplayer Features", value=True)
1204
-
1205
- ewpgenerate_button = gr.Button("Generate Story and Timeline")
1206
-
1207
  @gr.render(inputs=ewpwacustom_config) #ewpgame_structure_output_text_with_media
1208
  def update(ewpwacustom_config):
1209
  return show_elements_json_input(ewpwacustom_config)
 
1055
  gr.Code(json.dumps(experimetal_config, default=lambda o: o.__dict__, indent=2), label=experimetal_config_name) #str(experimetal_config)
1056
 
1057
  with gr.Tab("Test and Edit Config"):
1058
+ # with gr.Tab("Manual - Config Without Assets"):
1059
+ # with gr.Row():
1060
+ # with gr.Column(scale=2):
1061
+ # gr.Markdown("# Text-based Adventure Game")
1062
+
1063
+ # description = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
1064
+ # choices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
1065
+ # submit_btn = gr.Button("Make Choice")
1066
+ # game_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
1067
+ # game_session = gr.State(value=initgameinfo[3])
1068
+ # submit_btn.click(
1069
+ # make_choice,
1070
+ # inputs=[choices, game_session],
1071
+ # outputs=[description, choices, game_log, game_session]
1072
+ # )
1073
+ # with gr.Column(scale=1):
1074
+ # gr.Markdown("# Debugging")
1075
+ # error_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
1076
+ # with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
1077
+ # custom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
1078
+ # custom_configbtn = gr.Button("Load Custom Config")
1079
+
1080
+ # custom_configbtn.click(
1081
+ # load_game,
1082
+ # inputs=[custom_config],
1083
+ # outputs=[error_box, game_log, description, choices, game_session, custom_config]
1084
+ # )
1085
  with gr.Tab("Manual - Config With Assets"):
1086
+ gr.HTML("Placeholder as not complete yet (3D not supported, and time (esp need for audio)")
1087
  with gr.Row():
1088
  with gr.Column(scale=2):
1089
  gr.Markdown("# Text-based Adventure Game")
 
1126
  inputs=[wacustom_config, wamediabool],
1127
  outputs=[waerror_box, wagame_log, wadescription, wachoices, wacustom_config, wagame_session, wamedia]
1128
  )
 
 
 
1129
 
1130
  with gr.Tab("Semi-Auto - Edit config while playing game"):
1131
+ with gr.Row():
1132
+ gr.HTML("Current main ")
1133
+ gr.HTML("-- Incomplete -- Current problem is passing values from rendered items to the config box <br>Need a way have dropdowns for the filelist and transitions eg. changing transitions must auto update choices <br>Config to components has hardcoded variables based on the auto gen so changes break it")
1134
  with gr.Column(scale=1):
1135
  gr.Markdown("# Debugging")
1136
  with gr.Row():
1137
+ with gr.Column():
1138
+ ewpwaerror_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
1139
+
1140
+
1141
+ with gr.Accordion("Generate a new config"):
1142
+ with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
1143
+ gr.Markdown("# Story and Timeline Generator")
1144
+ gr.Markdown("Click the button to generate a random timeline and story based on UI elements and story events. <br>Ask an LLM to use this to write a story around")
1145
+ #with gr.Row():
1146
+ #ewpgame_structure_output_text_with_media = gr.Code(language="json")
1147
+ #ewpgame_structure_output_text = gr.Code(language="json")
1148
+ with gr.Row():
1149
+ ewptimeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
1150
+ #ewptimeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
1151
+ with gr.Column():
1152
+ ewptimeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
1153
+ ewptimeline_selected_lists_text = gr.Textbox(label="Selected Idea Lists for Inspiration", lines=2)
1154
+ ewpstory_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
1155
+ with gr.Row():
1156
+ ewpgenerate_no_story_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of story timeline points")
1157
+ ewpgenerate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
1158
+ #ewpgenerate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
1159
+ #ewpgenerate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
1160
+ with gr.Row():
1161
+ ewptimeline_num_lists_slider = gr.Slider(minimum=1, maximum=len(all_idea_lists), step=1, label="Number of Lists to Consider", value=3)
1162
+ ewptimeline_items_per_list_slider = gr.Slider(minimum=1, maximum=10, step=1, label="Items per List", value=3)
1163
+ ewptimeline_include_existing_games = gr.Checkbox(label="Include Existing Game Inspirations", value=True)
1164
+ ewptimeline_include_multiplayer = gr.Checkbox(label="Include Multiplayer Features", value=True)
1165
+
1166
+ ewpgenerate_button = gr.Button("Generate Story and Timeline")
1167
+
1168
  ewpwacustom_config = gr.Textbox(label="Custom Configuration (JSON)", lines=4) #value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=4) #Commented out due to initial load issues
1169
  ewpwacustom_configbtn = gr.Button("Load Custom Config")
1170
 
 
1206
  outputs=[ewpwaerror_box, ewpwagame_log, ewpwadescription, ewpwachoices, ewpwacustom_config, ewpwagame_session, ewpwamedia]
1207
  )
1208
  with gr.Column(scale=1):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1209
  @gr.render(inputs=ewpwacustom_config) #ewpgame_structure_output_text_with_media
1210
  def update(ewpwacustom_config):
1211
  return show_elements_json_input(ewpwacustom_config)