kwabs22 commited on
Commit
b826437
·
1 Parent(s): 52f0fc1

Merge game and edit interfaces

Browse files
Files changed (1) hide show
  1. app.py +87 -4
app.py CHANGED
@@ -644,7 +644,7 @@ with gr.Blocks() as demo:
644
  with gr.Tab("Asset path Assist"):
645
  gr.HTML("Make Files and Text ideas for the field and paste")
646
  with gr.Accordion("Upload Files for config"):
647
- gr.Markdown("# Media Saver and Explorer (refresh file list to be resolved)")
648
  with gr.Tab("Upload Files"):
649
  file_input = gr.File(label="Choose File to Upload")
650
  save_output = gr.Textbox(label="Upload Status")
@@ -696,7 +696,7 @@ with gr.Blocks() as demo:
696
  with gr.Accordion("Image Gen or Animation HF Spaces/Sites (Click Here to Open) - Have to download and upload at the the top", open=False):
697
  with gr.Row():
698
  linktoimagegen = gr.Dropdown(choices=["https://huggingface.co/spaces/linoyts/scribble-sdxl-flash", "https://prodia-sdxl-stable-diffusion-xl.hf.space", "https://prodia-fast-stable-diffusion.hf.space", "https://lllyasviel-ic-light.hf.space", "https://gparmar-img2img-turbo-sketch.hf.space", "https://artificialguybr-artificialguybr-demo-lora.hf.space", "https://kadirnar-open-sora.hf.space", "https://bytedance-animatediff-lightning.hf.space", "https://bytedance-hyper-sdxl-1step-t2i.hf.space", "https://ehristoforu-dalle-3-xl-lora-v2.hf.space", "https://multimodalart-cosxl.hf.space", "https://radames-real-time-text-to-image-sdxl-lightning.hf.space", "https://cagliostrolab-animagine-xl-3-1.hf.space", "https://wangfuyun-animatelcm-svd.hf.space" "https://modelscope-transferanything.hf.space", "https://visionmaze-magic-me.hf.space", "https://wangfuyun-animatelcm.hf.space", "https://artgan-diffusion-api.hf.space", "https://multimodalart-stable-cascade.hf.space", "https://ap123-sdxl-lightning.hf.space", "https://google-sdxl.hf.space", "https://guoyww-animatediff.hf.space", "https://segmind-segmind-stable-diffusion.hf.space", "https://simianluo-latent-consistency-model.hf.space", "https://artificialguybr-studio-ghibli-lora-sdxl.hf.space", "https://artificialguybr-pixel-art-generator.hf.space", "https://fffiloni-sdxl-control-loras.hf.space"], label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True)
699
- imagegenspacebtn = gr.Button("Use the chosen URL to load interface with a chat model")
700
  imagegenspace = gr.HTML("Chat Space Chosen will load here")
701
  imagegenspacebtn.click(display_website, inputs=linktoimagegen, outputs=imagegenspace)
702
  with gr.Column(scale=3):
@@ -741,6 +741,87 @@ 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("Export Options"):
745
  gr.HTML("Placeholder - My Custom JS, Playcanvas, Unreal Engine")
746
 
@@ -894,8 +975,10 @@ with gr.Blocks() as demo:
894
  with gr.Tab("Advanced Config Creator"):
895
  gr.HTML("Config with More than text and images")
896
 
 
 
897
 
898
- with gr.Tab("Asset Generation"):
899
  gr.HTML("With some ideas from gemini-1.5-flash-api-0514 and reka-flash-preview-20240611 <br><br>Licenses for the spaces still to be evaluated")
900
 
901
  with gr.Tab("Save files"):
@@ -977,7 +1060,7 @@ with gr.Blocks() as demo:
977
  gr.HTML("Speed - Groq, SambaNova, https://www.etched.com/announcing-etched ")
978
  gr.HTML("Price - Coding - https://aider.chat/docs/leaderboards/ - https://www.deepseek.com/ 0.3 per million - is this per token or chinese character as that means converting code to chinese if possible can save api cost?")
979
  with gr.Tab("Asset loading test"):
980
- gr.HTML("SDXL, SVD and Stable Audio used for the test assets (For commercial use need a licence)")
981
  with gr.Row():
982
  gr.Image(value="testmedia/Flash scribble SDXL - random squiggles as roads.webp")
983
  gr.Video(value="testmedia/SVD - random squiggles as roads video 004484.mp4")
 
644
  with gr.Tab("Asset path Assist"):
645
  gr.HTML("Make Files and Text ideas for the field and paste")
646
  with gr.Accordion("Upload Files for config"):
647
+ gr.Markdown("# Media Saver and Explorer (refresh file list to be resolved - for now upload all files and reload the space - they persist as long as the space creator doesnt reset the space - will add manual clear options later)")
648
  with gr.Tab("Upload Files"):
649
  file_input = gr.File(label="Choose File to Upload")
650
  save_output = gr.Textbox(label="Upload Status")
 
696
  with gr.Accordion("Image Gen or Animation HF Spaces/Sites (Click Here to Open) - Have to download and upload at the the top", open=False):
697
  with gr.Row():
698
  linktoimagegen = gr.Dropdown(choices=["https://huggingface.co/spaces/linoyts/scribble-sdxl-flash", "https://prodia-sdxl-stable-diffusion-xl.hf.space", "https://prodia-fast-stable-diffusion.hf.space", "https://lllyasviel-ic-light.hf.space", "https://gparmar-img2img-turbo-sketch.hf.space", "https://artificialguybr-artificialguybr-demo-lora.hf.space", "https://kadirnar-open-sora.hf.space", "https://bytedance-animatediff-lightning.hf.space", "https://bytedance-hyper-sdxl-1step-t2i.hf.space", "https://ehristoforu-dalle-3-xl-lora-v2.hf.space", "https://multimodalart-cosxl.hf.space", "https://radames-real-time-text-to-image-sdxl-lightning.hf.space", "https://cagliostrolab-animagine-xl-3-1.hf.space", "https://wangfuyun-animatelcm-svd.hf.space" "https://modelscope-transferanything.hf.space", "https://visionmaze-magic-me.hf.space", "https://wangfuyun-animatelcm.hf.space", "https://artgan-diffusion-api.hf.space", "https://multimodalart-stable-cascade.hf.space", "https://ap123-sdxl-lightning.hf.space", "https://google-sdxl.hf.space", "https://guoyww-animatediff.hf.space", "https://segmind-segmind-stable-diffusion.hf.space", "https://simianluo-latent-consistency-model.hf.space", "https://artificialguybr-studio-ghibli-lora-sdxl.hf.space", "https://artificialguybr-pixel-art-generator.hf.space", "https://fffiloni-sdxl-control-loras.hf.space"], label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True)
699
+ imagegenspacebtn = gr.Button("Use the chosen URL to load interface with a image generation model")
700
  imagegenspace = gr.HTML("Chat Space Chosen will load here")
701
  imagegenspacebtn.click(display_website, inputs=linktoimagegen, outputs=imagegenspace)
702
  with gr.Column(scale=3):
 
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
 
 
975
  with gr.Tab("Advanced Config Creator"):
976
  gr.HTML("Config with More than text and images")
977
 
978
+ with gr.Tab("LLM as custom controllers Considerations"):
979
+ gr.HTML("Controls changed the scope of the game eg. mouse vs keyboard vs console controller vs remote vs touch screen <br>LLM can be vision/surveilance based controler (eg. MGS/GTA camera gauged by an actual camera in real life) or it can be a companion (offline/off console game progrssion ideas)")
980
 
981
+ with gr.Tab("Asset Generation Considerations"):
982
  gr.HTML("With some ideas from gemini-1.5-flash-api-0514 and reka-flash-preview-20240611 <br><br>Licenses for the spaces still to be evaluated")
983
 
984
  with gr.Tab("Save files"):
 
1060
  gr.HTML("Speed - Groq, SambaNova, https://www.etched.com/announcing-etched ")
1061
  gr.HTML("Price - Coding - https://aider.chat/docs/leaderboards/ - https://www.deepseek.com/ 0.3 per million - is this per token or chinese character as that means converting code to chinese if possible can save api cost?")
1062
  with gr.Tab("Asset loading test"):
1063
+ gr.HTML("SDXL (linoyts/scribble-sdxl-flash), SVD and Stable Audio used for the test assets (For commercial use need a licence)")
1064
  with gr.Row():
1065
  gr.Image(value="testmedia/Flash scribble SDXL - random squiggles as roads.webp")
1066
  gr.Video(value="testmedia/SVD - random squiggles as roads video 004484.mp4")