Spaces:
Runtime error
Runtime error
kwabs22
commited on
Commit
·
21ccdf9
1
Parent(s):
b826437
Merge game and edit interfaces attempts
Browse files
app.py
CHANGED
|
@@ -703,7 +703,7 @@ with gr.Blocks() as demo:
|
|
| 703 |
with gr.Tab("Schema First"):
|
| 704 |
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
|
| 705 |
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")
|
| 706 |
-
with gr.Accordion(""):
|
| 707 |
gr.Markdown("Asset Generation")
|
| 708 |
gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
|
| 709 |
input_text = gr.Textbox(label="Input Text", lines=10)
|
|
@@ -741,87 +741,6 @@ with gr.Blocks() as demo:
|
|
| 741 |
with gr.Tab("Asset First"):
|
| 742 |
gr.HTML("Make Asset and make the transitions using LLM")
|
| 743 |
|
| 744 |
-
with gr.Tab("Edit config while playing game"):
|
| 745 |
-
gr.HTML("-- Incomplete -- Issue here is updating all variables")
|
| 746 |
-
with gr.Row():
|
| 747 |
-
with gr.Column(scale=1):
|
| 748 |
-
gr.Markdown("# Text-based Adventure Game")
|
| 749 |
-
|
| 750 |
-
ewpwadescription = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
|
| 751 |
-
ewpwamediabool = gr.State(value=True)
|
| 752 |
-
ewpwamedia = gr.State(["testmedia/Stable Audio - Raindrops, output.wav"])
|
| 753 |
-
|
| 754 |
-
@gr.render(inputs=ewpwamedia)
|
| 755 |
-
def dynamic_with_media(media_items):
|
| 756 |
-
print(media_items)
|
| 757 |
-
with gr.Group() as ewpwamediagrouping:
|
| 758 |
-
gr.HTML("Placeholder to load all media tests - still need to test clearing media on ")
|
| 759 |
-
if media_items == []:
|
| 760 |
-
gr.Markdown("No media items to display.")
|
| 761 |
-
else:
|
| 762 |
-
for item in media_items:
|
| 763 |
-
render = create_media_component(item)
|
| 764 |
-
|
| 765 |
-
return ewpwamediagrouping
|
| 766 |
-
|
| 767 |
-
ewpwachoices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
|
| 768 |
-
ewpwasubmit_btn = gr.Button("Make Choice")
|
| 769 |
-
ewpwagame_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
|
| 770 |
-
ewpwagame_session = gr.State(value=initgameinfo[3])
|
| 771 |
-
ewpwasubmit_btn.click(
|
| 772 |
-
make_choice,
|
| 773 |
-
inputs=[ewpwachoices, ewpwagame_session, ewpwamediabool],
|
| 774 |
-
outputs=[ewpwadescription, ewpwachoices, ewpwagame_log, ewpwagame_session, ewpwamedia]
|
| 775 |
-
)
|
| 776 |
-
with gr.Column(scale=1):
|
| 777 |
-
gr.Markdown("# Debugging")
|
| 778 |
-
ewpwaerror_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
|
| 779 |
-
with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
|
| 780 |
-
ewpwacustom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
|
| 781 |
-
ewpwacustom_configbtn = gr.Button("Load Custom Config")
|
| 782 |
-
|
| 783 |
-
ewpwacustom_configbtn.click(
|
| 784 |
-
load_game,
|
| 785 |
-
inputs=[ewpwacustom_config, ewpwamediabool],
|
| 786 |
-
outputs=[ewpwaerror_box, ewpwagame_log, ewpwadescription, ewpwachoices, ewpwacustom_config, ewpwagame_session, ewpwamedia]
|
| 787 |
-
)
|
| 788 |
-
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
|
| 789 |
-
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")
|
| 790 |
-
with gr.Accordion(""):
|
| 791 |
-
gr.Markdown("Asset Generation")
|
| 792 |
-
gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
|
| 793 |
-
ewpinput_text = gr.Textbox(label="Input Text", lines=10)
|
| 794 |
-
ewpoutput_group = gr.Group()
|
| 795 |
-
|
| 796 |
-
@gr.render(inputs=ewpinput_text)
|
| 797 |
-
def update(text):
|
| 798 |
-
return show_elements(text)
|
| 799 |
-
with gr.Accordion("Proto Config Assist"):
|
| 800 |
-
gr.Markdown("Editing placeholder")
|
| 801 |
-
with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
|
| 802 |
-
gr.Markdown("# Story and Timeline Generator")
|
| 803 |
-
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")
|
| 804 |
-
with gr.Accordion("JSON with no edits"):
|
| 805 |
-
with gr.Row():
|
| 806 |
-
ewptimeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
|
| 807 |
-
ewptimeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
|
| 808 |
-
ewpstory_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
|
| 809 |
-
with gr.Row():
|
| 810 |
-
ewpgame_structure_output_text_with_media = gr.Code(language="json")
|
| 811 |
-
ewpgame_structure_output_text = gr.Code(language="json")
|
| 812 |
-
|
| 813 |
-
with gr.Row():
|
| 814 |
-
ewpgenerate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
|
| 815 |
-
ewpgenerate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
|
| 816 |
-
ewpgenerate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
|
| 817 |
-
ewpgenerate_button = gr.Button("Generate Story and Timeline")
|
| 818 |
-
|
| 819 |
-
@gr.render(inputs=ewpgame_structure_output_text_with_media)
|
| 820 |
-
def update(ewpgame_structure_output_text_with_media):
|
| 821 |
-
return show_elements_json_input(ewpgame_structure_output_text_with_media)
|
| 822 |
-
|
| 823 |
-
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, ewpgame_structure_output_text_with_media, ewpgame_structure_output_text])
|
| 824 |
-
|
| 825 |
with gr.Tab("Export Options"):
|
| 826 |
gr.HTML("Placeholder - My Custom JS, Playcanvas, Unreal Engine")
|
| 827 |
|
|
@@ -901,6 +820,87 @@ with gr.Blocks() as demo:
|
|
| 901 |
with gr.Tab("Config With Minimal 3D considered"):
|
| 902 |
gr.HTML("Placeholder for Config with 3D assets")
|
| 903 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 904 |
with gr.Tab("Custom JS Config Creator"):
|
| 905 |
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)")
|
| 906 |
with gr.Tab("Simple Config Creator"):
|
|
|
|
| 703 |
with gr.Tab("Schema First"):
|
| 704 |
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
|
| 705 |
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")
|
| 706 |
+
with gr.Accordion("Test for config to gradio components order - ignore for now", open=False ):
|
| 707 |
gr.Markdown("Asset Generation")
|
| 708 |
gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
|
| 709 |
input_text = gr.Textbox(label="Input Text", lines=10)
|
|
|
|
| 741 |
with gr.Tab("Asset First"):
|
| 742 |
gr.HTML("Make Asset and make the transitions using LLM")
|
| 743 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 744 |
with gr.Tab("Export Options"):
|
| 745 |
gr.HTML("Placeholder - My Custom JS, Playcanvas, Unreal Engine")
|
| 746 |
|
|
|
|
| 820 |
with gr.Tab("Config With Minimal 3D considered"):
|
| 821 |
gr.HTML("Placeholder for Config with 3D assets")
|
| 822 |
|
| 823 |
+
with gr.Tab("Edit config while playing game"):
|
| 824 |
+
gr.HTML("-- Incomplete -- Issue here is updating all variables")
|
| 825 |
+
with gr.Row():
|
| 826 |
+
with gr.Column(scale=1):
|
| 827 |
+
gr.Markdown("# Text-based Adventure Game")
|
| 828 |
+
|
| 829 |
+
ewpwadescription = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
|
| 830 |
+
ewpwamediabool = gr.State(value=True)
|
| 831 |
+
ewpwamedia = gr.State(["testmedia/Stable Audio - Raindrops, output.wav"])
|
| 832 |
+
|
| 833 |
+
@gr.render(inputs=ewpwamedia)
|
| 834 |
+
def dynamic_with_media(media_items):
|
| 835 |
+
print(media_items)
|
| 836 |
+
with gr.Group() as ewpwamediagrouping:
|
| 837 |
+
gr.HTML("Placeholder to load all media tests - still need to test clearing media on ")
|
| 838 |
+
if media_items == []:
|
| 839 |
+
gr.Markdown("No media items to display.")
|
| 840 |
+
else:
|
| 841 |
+
for item in media_items:
|
| 842 |
+
render = create_media_component(item)
|
| 843 |
+
|
| 844 |
+
return ewpwamediagrouping
|
| 845 |
+
|
| 846 |
+
ewpwachoices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
|
| 847 |
+
ewpwasubmit_btn = gr.Button("Make Choice")
|
| 848 |
+
ewpwagame_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
|
| 849 |
+
ewpwagame_session = gr.State(value=initgameinfo[3])
|
| 850 |
+
ewpwasubmit_btn.click(
|
| 851 |
+
make_choice,
|
| 852 |
+
inputs=[ewpwachoices, ewpwagame_session, ewpwamediabool],
|
| 853 |
+
outputs=[ewpwadescription, ewpwachoices, ewpwagame_log, ewpwagame_session, ewpwamedia]
|
| 854 |
+
)
|
| 855 |
+
with gr.Column(scale=1):
|
| 856 |
+
gr.Markdown("# Debugging")
|
| 857 |
+
ewpwaerror_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
|
| 858 |
+
with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
|
| 859 |
+
ewpwacustom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
|
| 860 |
+
ewpwacustom_configbtn = gr.Button("Load Custom Config")
|
| 861 |
+
|
| 862 |
+
ewpwacustom_configbtn.click(
|
| 863 |
+
load_game,
|
| 864 |
+
inputs=[ewpwacustom_config, ewpwamediabool],
|
| 865 |
+
outputs=[ewpwaerror_box, ewpwagame_log, ewpwadescription, ewpwachoices, ewpwacustom_config, ewpwagame_session, ewpwamedia]
|
| 866 |
+
)
|
| 867 |
+
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
|
| 868 |
+
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")
|
| 869 |
+
# with gr.Accordion(""):
|
| 870 |
+
# gr.Markdown("Asset Generation")
|
| 871 |
+
# gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
|
| 872 |
+
# ewpinput_text = gr.Textbox(label="Input Text", lines=10)
|
| 873 |
+
# ewpoutput_group = gr.Group()
|
| 874 |
+
|
| 875 |
+
# @gr.render(inputs=ewpinput_text)
|
| 876 |
+
# def update(text):
|
| 877 |
+
# return show_elements(text)
|
| 878 |
+
with gr.Accordion("Proto Config Assist"):
|
| 879 |
+
gr.Markdown("Editing placeholder")
|
| 880 |
+
with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
|
| 881 |
+
gr.Markdown("# Story and Timeline Generator")
|
| 882 |
+
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")
|
| 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 |
+
with gr.Row():
|
| 889 |
+
ewpgame_structure_output_text_with_media = gr.Code(language="json")
|
| 890 |
+
ewpgame_structure_output_text = gr.Code(language="json")
|
| 891 |
+
|
| 892 |
+
with gr.Row():
|
| 893 |
+
ewpgenerate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
|
| 894 |
+
ewpgenerate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
|
| 895 |
+
ewpgenerate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
|
| 896 |
+
ewpgenerate_button = gr.Button("Generate Story and Timeline")
|
| 897 |
+
|
| 898 |
+
@gr.render(inputs=ewpgame_structure_output_text_with_media)
|
| 899 |
+
def update(ewpgame_structure_output_text_with_media):
|
| 900 |
+
return show_elements_json_input(ewpgame_structure_output_text_with_media)
|
| 901 |
+
|
| 902 |
+
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, ewpgame_structure_output_text_with_media, ewpgame_structure_output_text])
|
| 903 |
+
|
| 904 |
with gr.Tab("Custom JS Config Creator"):
|
| 905 |
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)")
|
| 906 |
with gr.Tab("Simple Config Creator"):
|