kwabs22 commited on
Commit
b13f95f
·
1 Parent(s): 6a73343

Refactor Proto Assist accordion to absorb mess

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -237,13 +237,14 @@ def create_story(timeline):
237
  story.append(f"The player interacted with {entry[2]}.")
238
  return " ".join(story)
239
 
240
- def generate_story_and_timeline(no_ui_timeline_points=10, num_lists=1, items_per_list=1, include_existing_games=False, include_multiplayer=False): # , no_media_timeline_points=5, include_media=True):
241
  # Pick 10 random UI items
242
  random_ui_items = pick_random_items(player_engagement_items, no_ui_timeline_points)
 
243
 
244
  # Generate UI and story timelines
245
  ui_timeline = generate_timeline(random_ui_items, "UI")
246
- story_timeline = generate_timeline(story_events, "Story")
247
 
248
  # Initialize merged timeline with UI and story timelines
249
  merged_timeline = ui_timeline + story_timeline
@@ -343,8 +344,8 @@ def show_elements_json_input(json_input):
343
  outputs.append(media)
344
 
345
  # New developernotes field
346
- #developernotes = gr.Textbox(label="Media", value=json.dumps(details.get('media', [])), interactive=True)
347
- #outputs.append(developernotes)
348
 
349
  def update_json(*current_values):
350
  updated_data = {"masterlocation1": {}}
@@ -770,14 +771,16 @@ with gr.Blocks() as demo:
770
  game_structure_output_text_with_media = gr.Code(language="json")
771
  game_structure_output_text = gr.Code(language="json")
772
  with gr.Accordion("JSON with no edits"):
 
773
  with gr.Row():
774
- timeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
775
  #timeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
776
  with gr.Column():
777
  timeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
778
  timeline_selected_lists_text = gr.Textbox(label="Selected Lists", lines=2)
779
  story_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
780
  with gr.Row():
 
781
  generate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
782
  #generate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
783
  #generate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
@@ -797,7 +800,7 @@ with gr.Blocks() as demo:
797
  def update(game_structure_output_text_with_media):
798
  return show_elements_json_input(game_structure_output_text_with_media)
799
 
800
- generate_button.click(generate_story_and_timeline, inputs=[generate_no_ui_timeline_points, timeline_num_lists_slider, timeline_items_per_list_slider, timeline_include_existing_games, timeline_include_multiplayer], outputs=[timeline_output_with_assets, story_output, game_structure_output_text_with_media, timeline_output_text, timeline_selected_lists_text]) #, generate_no_media_timeline_points, generate_with_media_check], outputs=[timeline_output_with_assets, timeline_output, story_output, game_structure_output_text_with_media, game_structure_output_text])
801
 
802
  with gr.Accordion("Prompt Engineering as basis for ideation process", open=False):
803
  gr.HTML("Current Assited workflow idea - Story timeline events suggestions (LLM / Premade List) | Merging events with premade mermaid structures (LLM + Story Text + Mermaid Text) | Edit mermaid till satisfied (LLM + Story Text) | Ask LLM to convert to config (LLM + JSON Text) | Edit config (LLM / User with format assistance or not) | Playtest and go back to mermaaid or config if there are problems")
@@ -1076,7 +1079,7 @@ Creating more diverse paths through the game""")
1076
  gr.HTML("Placeholder for Config with 3D assets")
1077
 
1078
  with gr.Tab("Semi-Auto - Edit config while playing game"):
1079
- gr.HTML("-- Incomplete -- 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")
1080
  with gr.Row():
1081
  with gr.Column(scale=1):
1082
  with gr.Group():
 
237
  story.append(f"The player interacted with {entry[2]}.")
238
  return " ".join(story)
239
 
240
+ def generate_story_and_timeline(no_story_timeline_points=10, no_ui_timeline_points=10, num_lists=1, items_per_list=1, include_existing_games=False, include_multiplayer=False): # , no_media_timeline_points=5, include_media=True):
241
  # Pick 10 random UI items
242
  random_ui_items = pick_random_items(player_engagement_items, no_ui_timeline_points)
243
+ random_story_items = pick_random_items(story_events, no_story_timeline_points)
244
 
245
  # Generate UI and story timelines
246
  ui_timeline = generate_timeline(random_ui_items, "UI")
247
+ story_timeline = generate_timeline(random_story_items, "Story")
248
 
249
  # Initialize merged timeline with UI and story timelines
250
  merged_timeline = ui_timeline + story_timeline
 
344
  outputs.append(media)
345
 
346
  # New developernotes field
347
+ developernotes = gr.Textbox(label="Media", value=json.dumps(details.get('developernotes', [])), interactive=True)
348
+ outputs.append(developernotes)
349
 
350
  def update_json(*current_values):
351
  updated_data = {"masterlocation1": {}}
 
771
  game_structure_output_text_with_media = gr.Code(language="json")
772
  game_structure_output_text = gr.Code(language="json")
773
  with gr.Accordion("JSON with no edits"):
774
+ gr.HTML("A long game is a bunch of short games")
775
  with gr.Row():
776
+ timeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered (gaps = side quests)", lines=25)
777
  #timeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
778
  with gr.Column():
779
  timeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
780
  timeline_selected_lists_text = gr.Textbox(label="Selected Lists", lines=2)
781
  story_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
782
  with gr.Row():
783
+ generate_no_story_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of story timeline points")
784
  generate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
785
  #generate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
786
  #generate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
 
800
  def update(game_structure_output_text_with_media):
801
  return show_elements_json_input(game_structure_output_text_with_media)
802
 
803
+ generate_button.click(generate_story_and_timeline, inputs=[generate_no_story_timeline_points, generate_no_ui_timeline_points, timeline_num_lists_slider, timeline_items_per_list_slider, timeline_include_existing_games, timeline_include_multiplayer], outputs=[timeline_output_with_assets, story_output, game_structure_output_text_with_media, timeline_output_text, timeline_selected_lists_text]) #, generate_no_media_timeline_points, generate_with_media_check], outputs=[timeline_output_with_assets, timeline_output, story_output, game_structure_output_text_with_media, game_structure_output_text])
804
 
805
  with gr.Accordion("Prompt Engineering as basis for ideation process", open=False):
806
  gr.HTML("Current Assited workflow idea - Story timeline events suggestions (LLM / Premade List) | Merging events with premade mermaid structures (LLM + Story Text + Mermaid Text) | Edit mermaid till satisfied (LLM + Story Text) | Ask LLM to convert to config (LLM + JSON Text) | Edit config (LLM / User with format assistance or not) | Playtest and go back to mermaaid or config if there are problems")
 
1079
  gr.HTML("Placeholder for Config with 3D assets")
1080
 
1081
  with gr.Tab("Semi-Auto - Edit config while playing game"):
1082
+ 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")
1083
  with gr.Row():
1084
  with gr.Column(scale=1):
1085
  with gr.Group():