kwabs22 commited on
Commit
f8bbf62
·
1 Parent(s): d6db96f

Merge game and edit interfaces

Browse files
Files changed (1) hide show
  1. app.py +28 -43
app.py CHANGED
@@ -853,50 +853,35 @@ with gr.Blocks() as demo:
853
  with gr.Column(scale=1):
854
  gr.Markdown("# Debugging")
855
  ewpwaerror_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
856
- with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
857
- ewpwacustom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
858
- ewpwacustom_configbtn = gr.Button("Load Custom Config")
859
-
860
- ewpwacustom_configbtn.click(
861
- load_game,
862
- inputs=[ewpwacustom_config, ewpwamediabool],
863
- outputs=[ewpwaerror_box, ewpwagame_log, ewpwadescription, ewpwachoices, ewpwacustom_config, ewpwagame_session, ewpwamedia]
864
- )
865
- gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
866
- gr.HTML("One prompt to be used to test models - <br>Please make 10 python lists for the types of media files and their purposes in a game and then use those lists to random generate a timeline of 20 items when the function is called <br>Great next suggest ways to improve this function to create better timelines")
867
- # with gr.Accordion(""):
868
- # gr.Markdown("Asset Generation")
869
- # gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
870
- # ewpinput_text = gr.Textbox(label="Input Text", lines=10)
871
- # ewpoutput_group = gr.Group()
872
-
873
- # @gr.render(inputs=ewpinput_text)
874
- # def update(text):
875
- # return show_elements(text)
876
- with gr.Accordion("Proto Config Assist"):
877
- with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
878
- gr.Markdown("# Story and Timeline Generator")
879
- 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")
880
- with gr.Row():
881
- ewpgame_structure_output_text_with_media = gr.Code(language="json")
882
- ewpgame_structure_output_text = gr.Code(language="json")
883
- with gr.Accordion("JSON with no edits"):
884
- with gr.Row():
885
- ewptimeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
886
- ewptimeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
887
- ewpstory_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
888
 
889
- with gr.Row():
890
- ewpgenerate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
891
- ewpgenerate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
892
- ewpgenerate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
893
- ewpgenerate_button = gr.Button("Generate Story and Timeline")
894
-
895
- @gr.render(inputs=ewpwacustom_config) #ewpgame_structure_output_text_with_media
896
- def update(ewpwacustom_config):
897
- return show_elements_json_input(ewpwacustom_config)
898
-
899
- ewpgenerate_button.click(generate_story_and_timeline, inputs=[ewpgenerate_no_ui_timeline_points, ewpgenerate_no_media_timeline_points, ewpgenerate_with_media_check], outputs=[ewptimeline_output_with_assets, ewptimeline_output, ewpstory_output, ewpwacustom_config, ewpgame_structure_output_text]) #ewpgame_structure_output_text_with_media, ewpgame_structure_output_text])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
900
 
901
  with gr.Tab("Custom JS Config Creator"):
902
  gr.HTML("-- Incomplete -- Companion Space for zerogpu / client api workflow planning for a way to send a zip to the Basic Game Engine at the bottom of https://huggingface.co/spaces/KwabsHug/TestSvelteStatic (Also to test how much can be done majority on cpu)")
 
853
  with gr.Column(scale=1):
854
  gr.Markdown("# Debugging")
855
  ewpwaerror_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
856
+ ewpwacustom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
857
+ ewpwacustom_configbtn = gr.Button("Load Custom Config")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
858
 
859
+ ewpwacustom_configbtn.click(
860
+ load_game,
861
+ inputs=[ewpwacustom_config, ewpwamediabool],
862
+ outputs=[ewpwaerror_box, ewpwagame_log, ewpwadescription, ewpwachoices, ewpwacustom_config, ewpwagame_session, ewpwamedia]
863
+ )
864
+ with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
865
+ gr.Markdown("# Story and Timeline Generator")
866
+ 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")
867
+ with gr.Row():
868
+ ewpgame_structure_output_text_with_media = gr.Code(language="json")
869
+ ewpgame_structure_output_text = gr.Code(language="json")
870
+ with gr.Row():
871
+ ewptimeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
872
+ ewptimeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
873
+ ewpstory_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
874
+ with gr.Row():
875
+ ewpgenerate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
876
+ ewpgenerate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
877
+ ewpgenerate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
878
+ ewpgenerate_button = gr.Button("Generate Story and Timeline")
879
+
880
+ @gr.render(inputs=ewpwacustom_config) #ewpgame_structure_output_text_with_media
881
+ def update(ewpwacustom_config):
882
+ return show_elements_json_input(ewpwacustom_config)
883
+
884
+ ewpgenerate_button.click(generate_story_and_timeline, inputs=[ewpgenerate_no_ui_timeline_points, ewpgenerate_no_media_timeline_points, ewpgenerate_with_media_check], outputs=[ewptimeline_output_with_assets, ewptimeline_output, ewpstory_output, ewpwacustom_config, ewpgame_structure_output_text]) #ewpgame_structure_output_text_with_media, ewpgame_structure_output_text])
885
 
886
  with gr.Tab("Custom JS Config Creator"):
887
  gr.HTML("-- Incomplete -- Companion Space for zerogpu / client api workflow planning for a way to send a zip to the Basic Game Engine at the bottom of https://huggingface.co/spaces/KwabsHug/TestSvelteStatic (Also to test how much can be done majority on cpu)")