kwabs22 commited on
Commit
85e04a6
·
1 Parent(s): c6418f1

Test mermaid editor load

Browse files
Files changed (2) hide show
  1. README.md +1 -0
  2. app.py +239 -233
README.md CHANGED
@@ -7,6 +7,7 @@ sdk: gradio
7
  sdk_version: 4.36.1
8
  app_file: app.py
9
  pinned: false
 
10
  models:
11
  - Qwen/Qwen2-0.5B-Instruct
12
  ---
 
7
  sdk_version: 4.36.1
8
  app_file: app.py
9
  pinned: false
10
+ short_description: Experimental workflow for planning story driven games and porting
11
  models:
12
  - Qwen/Qwen2-0.5B-Instruct
13
  ---
app.py CHANGED
@@ -752,167 +752,173 @@ with gr.Blocks() as demo:
752
  <div style="width: 20%; text-align: center">llms good at short questions </div>
753
  <div style="width: 20%; text-align: center">HF + Gradio allows for api use so this my prototype tool for tool use test</div>
754
  </div>""")
755
- with gr.Accordion("Qwen 0.5B as Space Guide Tests", open=False):
756
- with gr.Tab("General FAQ Attempt"):
757
- FAQMainOutput = gr.TextArea(placeholder='Output will show here')
758
- FAQCustomButtonInput = gr.TextArea(lines=1, placeholder='Prompt goes here')
759
 
760
- for category_name, category_prompts in FAQAllprompts.items():
761
- with gr.Accordion(f"General {category_name} Pattern based", open=False):
762
- with gr.Group():
763
- for index, (prompt, _) in enumerate(category_prompts):
764
- button = gr.Button(prompt)
765
- button.click(llmguide_generate_response, inputs=[FAQCustomButtonInput, gr.State(index), gr.State(category_name)], outputs=FAQMainOutput)
766
-
767
- with gr.Tab("General RAG (Pathfinder?) Attempt"):
768
- gr.HTML("Placeholder for weak RAG Type Charcter interaction test aka input for JSON 'Knowledge Base' Input")
769
- # gr.Interface(
770
- # fn=rag,
771
- # inputs=[
772
- # gr.Textbox(lines=2, placeholder="Enter your question here..."),
773
- # gr.Checkbox(label="Stream output")
774
- # ],
775
- # outputs=[
776
- # gr.Textbox(label="Generated Response"),
777
- # gr.Textbox(label="Tokens per second"),
778
- # gr.Textbox(label="Resource Usage")
779
- # ],
780
- # title="RAG Q&A System with GPU Acceleration and Resource Monitoring",
781
- # description="Ask a question and get an answer based on the retrieved context. The response is generated using a GPU-accelerated model. Resource usage is logged at the end of generation."
782
- # )
783
-
784
- gr.Interface(
785
- fn=process_query,
786
- inputs=[
787
- gr.Textbox(lines=2, placeholder="Enter your question here..."),
788
- gr.Checkbox(label="Use RAG"),
789
- gr.Checkbox(label="Stream output")
790
- ],
791
- outputs=[
792
- gr.Textbox(label="Generated Response"),
793
- gr.Textbox(label="Tokens per second"),
794
- gr.Textbox(label="RAM Usage"),
795
- gr.Textbox(label="Referenced Documents")
796
- ],
797
- title="RAG/Non-RAG Q&A System",
798
- description="Ask a question with or without using RAG. The response is generated using a GPU-accelerated model. RAM usage and referenced document IDs (for RAG) are logged."
799
- )
800
-
801
- with gr.Tab("Any Request to Qwen2-0.5B"):
802
- gr.HTML("Placeholder for https://huggingface.co/h2oai/h2o-danube3-500m-chat-GGUF as alternative")
803
- gr.HTML("Placeholder for qwen 2 72b as alternative use checkbox and gradio client api call")
804
- gr.Markdown("# Qwen-0.5B-Instruct Language Model")
805
- gr.Markdown("This demo uses the Qwen-0.5B-Instruct model to generate responses based on your input.")
806
- gr.HTML("Example prompts: <br>I am writing a story about a chef. please write dishes to appear on the menu. <br>What are the most common decisions that a chef story would include? <br>What are the kinds problems that a chef story would include? <br>What are the kinds of out of reach goals that a chef story would include? <br>Continue this config - Paste any complete block of the config")
807
-
808
- with gr.Row():
809
- with gr.Column():
810
- llmguide_prompt = gr.Textbox(lines=2, placeholder="Enter your prompt here...")
811
- llmguide_stream_checkbox = gr.Checkbox(label="Enable streaming")
812
- llmguide_submit_button = gr.Button("Generate")
813
-
814
- with gr.Column():
815
- llmguide_output = gr.Textbox(lines=10, label="Generated Response")
816
- llmguide_tokens_per_second = gr.Textbox(label="Tokens per Second")
817
-
818
- llmguide_submit_button.click(
819
- llmguide_generate_response,
820
- inputs=[llmguide_prompt, llmguide_stream_checkbox],
821
- outputs=[llmguide_output, llmguide_tokens_per_second],
822
- )
823
-
824
- with gr.Accordion("Decisions Creation to Story to Config Conversation", open=False):
825
- with gr.Tab("Timeline Guide for Config Generation or evelution"):
826
- with gr.Accordion("Empty Config shape for explaining to LLM", open=False):
827
- gr.HTML(f"placeholder for current empty JSON config shape")
828
- gr.HTML("Structural indicators of quality of config")
829
- with gr.Tab("Random Suggestions"):
830
- # timeline_num_lists_slider = gr.Slider(minimum=1, maximum=len(all_idea_lists), step=1, label="Number of Lists to Consider", value=3)
831
- # timeline_items_per_list_slider = gr.Slider(minimum=1, maximum=10, step=1, label="Items per List", value=3)
832
- # timeline_generate_button = gr.Button("Generate Random Suggestions")
833
- # timeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
834
-
835
- # timeline_generate_button.click(
836
- # timeline_get_random_suggestions,
837
- # inputs=[timeline_num_lists_slider, timeline_items_per_list_slider],
838
- # outputs=[timeline_output_text]
839
- # )
840
- timeline_num_lists_slider = gr.Slider(minimum=1, maximum=len(all_idea_lists), step=1, label="Number of Lists to Consider", value=3)
841
- timeline_items_per_list_slider = gr.Slider(minimum=1, maximum=10, step=1, label="Items per List", value=3)
842
- timeline_include_existing_games = gr.Checkbox(label="Include Existing Game Inspirations", value=True)
843
- timeline_include_multiplayer = gr.Checkbox(label="Include Multiplayer Features", value=True)
844
- timeline_generate_button = gr.Button("Generate Random Suggestions")
845
- timeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
846
- timeline_selected_lists_text = gr.Textbox(label="Selected Lists", lines=2)
847
-
848
- timeline_generate_button.click(
849
- timeline_get_random_suggestions,
850
- inputs=[timeline_num_lists_slider, timeline_items_per_list_slider, timeline_include_existing_games, timeline_include_multiplayer],
851
- outputs=[timeline_output_text, timeline_selected_lists_text]
852
  )
853
- with gr.Tab("Config Specific"):
854
- gr.HTML("Timeline for making Timelines?")
855
- gr.HTML("Componets (outside Code Support for Config): Decisions (and context explanation), Nested Sections, Media (Especially to affect decisions), Replayability (GTA and Tekken type mechanics in text form), Theme integration (Modified Varibles that affect UI or config order)")
856
- gr.HTML("From Nothing <br>")
857
- gr.HTML("From Existing <br>")
858
- with gr.Tab("Existing Game Analysis"):
859
- gr.HTML("Existing Games eg. GTA Heists - Same Map with overlapping branching narratives, Battlefront - Elites amongst Commoners, Tekken Casino (one mistake = 1/2 or 1/3 of your Resources) and Turn based: 'Tactics' type nintendo games, Chess (and any other tile based game) ")
860
- gr.HTML("Existing Game Rules for text - Cyberpunk RED, ")
861
- with gr.Tab("Multiplayer options"):
862
- gr.HTML("Community playthrough = Tally of players choices, Random item placed in a random location - first person to get it wins, Survival by location or characters met")
863
- with gr.Tab("Some Workflow Helpers (Removed as built into Semi-Auto)"):
864
- gr.HTML("Song / Random Scenario to 'full game' manual or auto is end goal ")
865
- gr.HTML("Main Priority is to make rails for the story to work on as a simplified view of a game is a linear path with loops (gameplay mechanics) <br> Below = Manual Edit (At bottom you can save the changes and copy it to test) <br>For LLM edit copy either the Timeline")
866
- gr.HTML("The problem is the assets generation isnt free and using spaces as api also clogs them (no way to know when ZeroGPUs are at lowest usage) so using iFrame is better for now <br> So worklfow -- Make Skeleton -- Use Iframe to get media -- then ask for details / story / gameplay loop ideas and add back to config")
867
- with gr.Tab("Schema First"):
868
- gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
869
- 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")
870
- with gr.Accordion("Test for config to gradio components order - ignore for now", open=False ):
871
- gr.Markdown("Asset Generation")
872
- gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
873
- input_text = gr.Textbox(label="Input Text", lines=10)
874
- output_group = gr.Group()
875
 
876
- @gr.render(inputs=input_text)
877
- def update(text):
878
- return show_elements(text)
879
- with gr.Accordion("Proto Config Assist"):
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.Row():
884
- game_structure_output_text_with_media = gr.Code(language="json")
885
- game_structure_output_text = gr.Code(language="json")
886
- with gr.Accordion("JSON with no edits"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
887
  with gr.Row():
888
- timeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
889
- timeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
890
- story_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
891
- with gr.Row():
892
- generate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
893
- generate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
894
- generate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
895
- generate_button = gr.Button("Generate Story and Timeline")
896
-
897
- @gr.render(inputs=game_structure_output_text_with_media)
898
- def update(game_structure_output_text_with_media):
899
- return show_elements_json_input(game_structure_output_text_with_media)
900
-
901
- generate_button.click(generate_story_and_timeline, inputs=[generate_no_ui_timeline_points, 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])
902
-
903
- with gr.Tab("Asset First"):
904
- gr.HTML("Make Asset and make the transitions using LLM")
905
 
906
- with gr.Tab("Export Options"):
907
- gr.HTML("Placeholder - My Custom JS, Playcanvas, Unreal Engine")
908
 
909
- with gr.Tab("Config Writing Considerations"):
910
- gr.HTML("Player Stats, Inventory and NPCS not implemented yet, so traversal type games best aka graph like structures <br> Game is like a universal translator so any concept can be covered")
911
 
912
- with gr.Accordion("Existing Config Crafting Progression - click to open", open=False):
913
- with gr.Tab("Quick Ways to evaluate current config"):
914
- gr.HTML("Ask SOTA LLMs This prompt: <br> This config is for a basic text based game engine. I dont have any structural metrics to assess the quality of the config. What JSON things can we look at to see if it may be too bland for a person testing the game? <br> Then Paste the Config with the prompt")
915
- gr.HTML("""Original Claude 3.5 Sonnet Response snippets: <br>
916
  Limited state variety: With only 13 states across 5 locations, the game might feel short and lacking in diversity. Consider adding more locations or states within existing locations.
917
  Low average choices: An average of 1.92 choices per state might make the game feel linear. Increasing the number of choices in more states could improve player engagement.
918
  Limited consequences: Only 3 states have consequences, which might make player choices feel less impactful. Adding more consequences could increase the sense of agency.
@@ -929,84 +935,84 @@ Expanding descriptions to create a richer narrative
929
  Incorporating media elements
930
  Creating more diverse paths through the game""")
931
 
932
- with gr.Tab("Main areas of considerations"):
933
- with gr.Tab("Mermaid Graphs and Nesting"):
934
- gr.HTML("Claude Artifacts to illustrate nested structure brainstorms - <br> https://claude.site/artifacts/4a910d81-1541-49f4-8531-4f27fe56cd1e <br> https://claude.site/artifacts/265e9242-2093-46e1-9011-ed6ad938be90?fullscreen=false <br> ")
935
- gr.HTML("")
936
- with gr.Tab("Structural Inspirations"):
937
- gr.HTML("GTA Heists - Replayability and stakes, Tekken - 2/3 mistakes = lost round ")
938
- gr.HTML("Sports Scores, ")
939
- with gr.Tab("Themes"):
940
- gr.HTML("")
941
-
942
- # import originalconfigatbeinningofthisspace, claude3_5_06072024configtips, tipsupdatedconfigatbeinningofthisspace from relatively_constant_variables
943
-
944
- with gr.Tab("Improvement of the default config"):
945
- gr.HTML("Example of how to advance a game config with LLM - end goal is to have automatic worflow that takes these considerations into account <br> Things missing from the game engine - Economics and Basic Politics (NPC affiliation)")
946
- gr.HTML("Suggestions from claude 3.5 on how to change config")
947
- display_originalconfigatbeinningofthisspace = originalconfigatbeinningofthisspace.replace(' ', '&nbsp;').replace('\n', '<br>')
948
- display_claude3_5_06072024configtips = claude3_5_06072024configtips.replace(' ', '&nbsp;').replace('\n', '<br>')
949
- display_tipsupdatedconfigatbeinningofthisspace = tipsupdatedconfigatbeinningofthisspace.replace(' ', '&nbsp;').replace('\n', '<br>')
950
- gr.HTML("""<div style="display: flex; justify-content: space-between; height: 900px; overflow: auto; ">
951
- <div style="flex: 1; margin: 0 10px; padding: 20px;">
952
- """ + display_originalconfigatbeinningofthisspace + """
953
- </div>
954
- <div style="flex: 1; margin: 0 10px; padding: 20px; width: 50%">
955
- """ + display_claude3_5_06072024configtips + """
956
- </div>
957
- <div style="flex: 1; margin: 0 10px; padding: 20px;">
958
- """ + display_tipsupdatedconfigatbeinningofthisspace + """
959
- </div>
960
- </div>""")
961
-
962
-
963
- with gr.Accordion("Temporary Asset Management Assist - click to open", open=False):
964
- gr.HTML("Make Files and Text ideas for the field and paste <br>When Space is restarted it will clear - zip export and import will be added later")
965
- with gr.Accordion("Upload Files for config"):
966
- 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/update the space - will add manual clear options later)")
967
- with gr.Tab("Upload Files"):
968
- file_input = gr.File(label="Choose File to Upload")
969
- save_output = gr.Textbox(label="Upload Status")
970
-
971
- with gr.Tab("File Explorer"):
972
-
973
- file_explorer = gr.FileExplorer(
974
- root_dir=SAVE_DIR,
975
- glob="*.*",
976
- file_count="single",
977
- height=300,
978
- label="Select a file to view"
 
 
 
 
 
 
 
 
 
 
 
 
 
979
  )
980
- with gr.Row():
981
- refresh_button = gr.Button("Refresh", scale=1)
982
- view_button = gr.Button("View File")
983
- image_output = gr.Image(label="Image Output", type="pil")
984
- audio_output = gr.Audio(label="Audio Output")
985
- video_output = gr.Video(label="Video Output")
986
- error_output = gr.Textbox(label="Error")
987
-
988
- file_input.upload(
989
- save_file,
990
- inputs=file_input,
991
- outputs=[save_output, file_explorer, file_input]
992
- )
993
-
994
- view_button.click(
995
- view_file,
996
- inputs=file_explorer,
997
- outputs=[image_output, audio_output, video_output, error_output]
998
- )
999
-
1000
- refresh_button.click(
1001
- refresh_file_explorer,
1002
- outputs=file_explorer
1003
- )
1004
-
1005
- with gr.Tab("Batch add files to config"):
1006
- gr.HTML("Placeholder for Config parser to allow dropdowns for the media parts of the config inserted to make assigning media quick")
1007
- gr.HTML("Placeholder for Config parser to allow for current zerospace creation and placement into the config (LLM can give list of media but still have to figure out workflow from there)")
1008
-
1009
- gr.HTML("Placeholder for clearing uploaded assets (public space and temporary persistence = sharing and space problems)")
1010
 
1011
  with gr.Tab("Test and Edit Config"):
1012
  gr.HTML("The main issue is frequent changes add more chances for bugs in how - manual and auto refer mainly to ensuring correct JSON format ")
@@ -1153,7 +1159,7 @@ Creating more diverse paths through the game""")
1153
  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])
1154
 
1155
  with gr.Tab("Asset Generation Considerations"):
1156
- gr.HTML("Licenses for the spaces still to be evaluated - June 2024 <br> Users to follow with cool spaces - https://huggingface.co/fffiloni, https://huggingface.co/artificialguybr, https://huggingface.co/radames, https://huggingface.co/multimodalart, ")
1157
 
1158
  with gr.Accordion("LLM HF Spaces/Sites (Click Here to Open) - Ask for a story and suggestions based on the autoconfig", open=False):
1159
  with gr.Row():
@@ -1366,7 +1372,6 @@ Creating more diverse paths through the game""")
1366
  with gr.Tab("Other Considerations"):
1367
  with gr.Tab("General"):
1368
  gr.HTML("Experiment for https://huggingface.co/spaces/ysharma/open-interpreter/blob/main/app.py inplementation with gradio client api")
1369
- gr.HTML("Some conderations for future integration: https://huggingface.co/spaces/dylanebert/3d-arena, https://github.com/fudan-generative-vision/hallo")
1370
 
1371
  gr.HTML("Useful Spaces and links: https://huggingface.co/spaces/artificialguybr/Stable-Audio-Open-Zero https://huggingface.co/spaces/stabilityai/TripoSR https://huggingface.co/spaces/wangfuyun/AnimateLCM-SVD https://huggingface.co/spaces/multimodalart/face-to-all https://huggingface.co/spaces/facebook/MusicGen https://huggingface.co/spaces/Doubiiu/tooncrafter")
1372
 
@@ -1381,6 +1386,7 @@ Creating more diverse paths through the game""")
1381
  with gr.Tab("Finetuning options"):
1382
  gr.HTML("Price - https://openpipe.ai/pricing")
1383
  with gr.Tab("Backend and/or Hosting?"):
 
1384
  gr.HTML("Prototyping and freemium <br>free api <br>HF Pro subscription")
1385
  gr.HTML("GPU (Data privacy) = No Rate limits? - https://replicate.com/pricing, https://lambdalabs.com/service/gpu-cloud https://huggingface.co/pricing#endpoints https://tensordock.com/cloud-gpus")
1386
  gr.HTML("Speed - Groq, SambaNova, https://www.etched.com/announcing-etched ")
 
752
  <div style="width: 20%; text-align: center">llms good at short questions </div>
753
  <div style="width: 20%; text-align: center">HF + Gradio allows for api use so this my prototype tool for tool use test</div>
754
  </div>""")
 
 
 
 
755
 
756
+ with gr.Accordion("Config and Asset Assistance - Click to open", open=False):
757
+ gr.HTML("Current Assited workflow idea - Story timeline events suggestions | Merging events with premade mermaid structures | Edit mermaid till satisfied | Ask LLM to convert to config | Edit config | Playtest and go back to mermaaid or config if there are problems")
758
+ with gr.Accordion("Qwen 0.5B as Space Guide Tests", open=False):
759
+ with gr.Tab("General FAQ Attempt"):
760
+ FAQMainOutput = gr.TextArea(placeholder='Output will show here')
761
+ FAQCustomButtonInput = gr.TextArea(lines=1, placeholder='Prompt goes here')
762
+
763
+ for category_name, category_prompts in FAQAllprompts.items():
764
+ with gr.Accordion(f"General {category_name} Pattern based", open=False):
765
+ with gr.Group():
766
+ for index, (prompt, _) in enumerate(category_prompts):
767
+ button = gr.Button(prompt)
768
+ button.click(llmguide_generate_response, inputs=[FAQCustomButtonInput, gr.State(index), gr.State(category_name)], outputs=FAQMainOutput)
769
+
770
+ with gr.Tab("General RAG (Pathfinder?) Attempt"):
771
+ gr.HTML("Placeholder for weak RAG Type Charcter interaction test aka input for JSON 'Knowledge Base' Input")
772
+ # gr.Interface(
773
+ # fn=rag,
774
+ # inputs=[
775
+ # gr.Textbox(lines=2, placeholder="Enter your question here..."),
776
+ # gr.Checkbox(label="Stream output")
777
+ # ],
778
+ # outputs=[
779
+ # gr.Textbox(label="Generated Response"),
780
+ # gr.Textbox(label="Tokens per second"),
781
+ # gr.Textbox(label="Resource Usage")
782
+ # ],
783
+ # title="RAG Q&A System with GPU Acceleration and Resource Monitoring",
784
+ # description="Ask a question and get an answer based on the retrieved context. The response is generated using a GPU-accelerated model. Resource usage is logged at the end of generation."
785
+ # )
786
+
787
+ gr.Interface(
788
+ fn=process_query,
789
+ inputs=[
790
+ gr.Textbox(lines=2, placeholder="Enter your question here..."),
791
+ gr.Checkbox(label="Use RAG"),
792
+ gr.Checkbox(label="Stream output")
793
+ ],
794
+ outputs=[
795
+ gr.Textbox(label="Generated Response"),
796
+ gr.Textbox(label="Tokens per second"),
797
+ gr.Textbox(label="RAM Usage"),
798
+ gr.Textbox(label="Referenced Documents")
799
+ ],
800
+ title="RAG/Non-RAG Q&A System",
801
+ description="Ask a question with or without using RAG. The response is generated using a GPU-accelerated model. RAM usage and referenced document IDs (for RAG) are logged."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
802
  )
803
+
804
+ with gr.Tab("Any Request to Qwen2-0.5B"):
805
+ gr.HTML("Placeholder for https://huggingface.co/h2oai/h2o-danube3-500m-chat-GGUF as alternative")
806
+ gr.HTML("Placeholder for qwen 2 72b as alternative use checkbox and gradio client api call")
807
+ gr.Markdown("# Qwen-0.5B-Instruct Language Model")
808
+ gr.Markdown("This demo uses the Qwen-0.5B-Instruct model to generate responses based on your input.")
809
+ gr.HTML("Example prompts: <br>I am writing a story about a chef. please write dishes to appear on the menu. <br>What are the most common decisions that a chef story would include? <br>What are the kinds problems that a chef story would include? <br>What are the kinds of out of reach goals that a chef story would include? <br>Continue this config - Paste any complete block of the config")
810
+
811
+ with gr.Row():
812
+ with gr.Column():
813
+ llmguide_prompt = gr.Textbox(lines=2, placeholder="Enter your prompt here...")
814
+ llmguide_stream_checkbox = gr.Checkbox(label="Enable streaming")
815
+ llmguide_submit_button = gr.Button("Generate")
 
 
 
 
 
 
 
 
 
816
 
817
+ with gr.Column():
818
+ llmguide_output = gr.Textbox(lines=10, label="Generated Response")
819
+ llmguide_tokens_per_second = gr.Textbox(label="Tokens per Second")
820
+
821
+ llmguide_submit_button.click(
822
+ llmguide_generate_response,
823
+ inputs=[llmguide_prompt, llmguide_stream_checkbox],
824
+ outputs=[llmguide_output, llmguide_tokens_per_second],
825
+ )
826
+
827
+ with gr.Accordion("Decisions / Timeline Creation to Story to Config Conversation", open=False):
828
+ with gr.Tab("Structures for interesting timeline progression"):
829
+ gr.HTML("Placeholder for mermaid diagrams")
830
+ gr.HTML("<iframe src='https://mermaid.live/' width='100%' height='1000px'></iframe>")
831
+ with gr.Tab("Timeline Guide for Config Generation or evelution"):
832
+ with gr.Accordion("Empty Config shape for explaining to LLM", open=False):
833
+ gr.HTML(f"placeholder for current empty JSON config shape")
834
+ gr.HTML("Structural indicators of quality of config")
835
+ with gr.Tab("Random Suggestions"):
836
+ # timeline_num_lists_slider = gr.Slider(minimum=1, maximum=len(all_idea_lists), step=1, label="Number of Lists to Consider", value=3)
837
+ # timeline_items_per_list_slider = gr.Slider(minimum=1, maximum=10, step=1, label="Items per List", value=3)
838
+ # timeline_generate_button = gr.Button("Generate Random Suggestions")
839
+ # timeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
840
+
841
+ # timeline_generate_button.click(
842
+ # timeline_get_random_suggestions,
843
+ # inputs=[timeline_num_lists_slider, timeline_items_per_list_slider],
844
+ # outputs=[timeline_output_text]
845
+ # )
846
+ timeline_num_lists_slider = gr.Slider(minimum=1, maximum=len(all_idea_lists), step=1, label="Number of Lists to Consider", value=3)
847
+ timeline_items_per_list_slider = gr.Slider(minimum=1, maximum=10, step=1, label="Items per List", value=3)
848
+ timeline_include_existing_games = gr.Checkbox(label="Include Existing Game Inspirations", value=True)
849
+ timeline_include_multiplayer = gr.Checkbox(label="Include Multiplayer Features", value=True)
850
+ timeline_generate_button = gr.Button("Generate Random Suggestions")
851
+ timeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
852
+ timeline_selected_lists_text = gr.Textbox(label="Selected Lists", lines=2)
853
+
854
+ timeline_generate_button.click(
855
+ timeline_get_random_suggestions,
856
+ inputs=[timeline_num_lists_slider, timeline_items_per_list_slider, timeline_include_existing_games, timeline_include_multiplayer],
857
+ outputs=[timeline_output_text, timeline_selected_lists_text]
858
+ )
859
+ with gr.Tab("Config Specific"):
860
+ gr.HTML("Timeline for making Timelines?")
861
+ gr.HTML("Componets (outside Code Support for Config): Decisions (and context explanation), Nested Sections, Media (Especially to affect decisions), Replayability (GTA and Tekken type mechanics in text form), Theme integration (Modified Varibles that affect UI or config order)")
862
+ gr.HTML("From Nothing <br>")
863
+ gr.HTML("From Existing <br>")
864
+ with gr.Tab("Existing Game Analysis"):
865
+ gr.HTML("Existing Games eg. GTA Heists - Same Map with overlapping branching narratives, Battlefront - Elites amongst Commoners, Tekken Casino (one mistake = 1/2 or 1/3 of your Resources) and Turn based: 'Tactics' type nintendo games, Chess (and any other tile based game) ")
866
+ gr.HTML("Existing Game Rules for text - Cyberpunk RED, ")
867
+ with gr.Tab("Multiplayer options"):
868
+ gr.HTML("Community playthrough = Tally of players choices, Random item placed in a random location - first person to get it wins, Survival by location or characters met")
869
+ with gr.Tab("Some Workflow Helpers (Removed as built into Semi-Auto)"):
870
+ gr.HTML("Song / Random Scenario to 'full game' manual or auto is end goal ")
871
+ gr.HTML("Main Priority is to make rails for the story to work on as a simplified view of a game is a linear path with loops (gameplay mechanics) <br> Below = Manual Edit (At bottom you can save the changes and copy it to test) <br>For LLM edit copy either the Timeline")
872
+ gr.HTML("The problem is the assets generation isnt free and using spaces as api also clogs them (no way to know when ZeroGPUs are at lowest usage) so using iFrame is better for now <br> So worklfow -- Make Skeleton -- Use Iframe to get media -- then ask for details / story / gameplay loop ideas and add back to config")
873
+ with gr.Tab("Schema First"):
874
+ gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
875
+ 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")
876
+ with gr.Accordion("Test for config to gradio components order - ignore for now", open=False ):
877
+ gr.Markdown("Asset Generation")
878
+ gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
879
+ input_text = gr.Textbox(label="Input Text", lines=10)
880
+ output_group = gr.Group()
881
+
882
+ @gr.render(inputs=input_text)
883
+ def update(text):
884
+ return show_elements(text)
885
+ with gr.Accordion("Proto Config Assist"):
886
+ with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
887
+ gr.Markdown("# Story and Timeline Generator")
888
+ 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")
889
+ with gr.Row():
890
+ game_structure_output_text_with_media = gr.Code(language="json")
891
+ game_structure_output_text = gr.Code(language="json")
892
+ with gr.Accordion("JSON with no edits"):
893
+ with gr.Row():
894
+ timeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
895
+ timeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
896
+ story_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
897
  with gr.Row():
898
+ generate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
899
+ generate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
900
+ generate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
901
+ generate_button = gr.Button("Generate Story and Timeline")
902
+
903
+ @gr.render(inputs=game_structure_output_text_with_media)
904
+ def update(game_structure_output_text_with_media):
905
+ return show_elements_json_input(game_structure_output_text_with_media)
906
+
907
+ generate_button.click(generate_story_and_timeline, inputs=[generate_no_ui_timeline_points, 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])
908
+
909
+ with gr.Tab("Asset First"):
910
+ gr.HTML("Make Asset and make the transitions using LLM")
 
 
 
 
911
 
912
+ with gr.Tab("Export Options"):
913
+ gr.HTML("Placeholder - My Custom JS, Playcanvas, Unreal Engine")
914
 
915
+ with gr.Tab("Config Writing Considerations"):
916
+ gr.HTML("Player Stats, Inventory and NPCS not implemented yet, so traversal type games best aka graph like structures <br> Game is like a universal translator so any concept can be covered")
917
 
918
+ with gr.Accordion("Existing Config Crafting Progression - click to open", open=False):
919
+ with gr.Tab("Quick Ways to evaluate current config"):
920
+ gr.HTML("Ask SOTA LLMs This prompt: <br> This config is for a basic text based game engine. I dont have any structural metrics to assess the quality of the config. What JSON things can we look at to see if it may be too bland for a person testing the game? <br> Then Paste the Config with the prompt")
921
+ gr.HTML("""Original Claude 3.5 Sonnet Response snippets: <br>
922
  Limited state variety: With only 13 states across 5 locations, the game might feel short and lacking in diversity. Consider adding more locations or states within existing locations.
923
  Low average choices: An average of 1.92 choices per state might make the game feel linear. Increasing the number of choices in more states could improve player engagement.
924
  Limited consequences: Only 3 states have consequences, which might make player choices feel less impactful. Adding more consequences could increase the sense of agency.
 
935
  Incorporating media elements
936
  Creating more diverse paths through the game""")
937
 
938
+ with gr.Tab("Main areas of considerations"):
939
+ with gr.Tab("Mermaid Graphs and Nesting"):
940
+ gr.HTML("Claude Artifacts to illustrate nested structure brainstorms - <br> https://claude.site/artifacts/4a910d81-1541-49f4-8531-4f27fe56cd1e <br> https://claude.site/artifacts/265e9242-2093-46e1-9011-ed6ad938be90?fullscreen=false <br> ")
941
+ gr.HTML("")
942
+ with gr.Tab("Structural Inspirations"):
943
+ gr.HTML("GTA Heists - Replayability and stakes, Tekken - 2/3 mistakes = lost round ")
944
+ gr.HTML("Sports Scores, ")
945
+ with gr.Tab("Themes"):
946
+ gr.HTML("")
947
+
948
+ # import originalconfigatbeinningofthisspace, claude3_5_06072024configtips, tipsupdatedconfigatbeinningofthisspace from relatively_constant_variables
949
+
950
+ with gr.Tab("Improvement of the default config"):
951
+ gr.HTML("Example of how to advance a game config with LLM - end goal is to have automatic worflow that takes these considerations into account <br> Things missing from the game engine - Economics and Basic Politics (NPC affiliation)")
952
+ gr.HTML("Suggestions from claude 3.5 on how to change config")
953
+ display_originalconfigatbeinningofthisspace = originalconfigatbeinningofthisspace.replace(' ', '&nbsp;').replace('\n', '<br>')
954
+ display_claude3_5_06072024configtips = claude3_5_06072024configtips.replace(' ', '&nbsp;').replace('\n', '<br>')
955
+ display_tipsupdatedconfigatbeinningofthisspace = tipsupdatedconfigatbeinningofthisspace.replace(' ', '&nbsp;').replace('\n', '<br>')
956
+ gr.HTML("""<div style="display: flex; justify-content: space-between; height: 900px; overflow: auto; ">
957
+ <div style="flex: 1; margin: 0 10px; padding: 20px;">
958
+ """ + display_originalconfigatbeinningofthisspace + """
959
+ </div>
960
+ <div style="flex: 1; margin: 0 10px; padding: 20px; width: 50%">
961
+ """ + display_claude3_5_06072024configtips + """
962
+ </div>
963
+ <div style="flex: 1; margin: 0 10px; padding: 20px;">
964
+ """ + display_tipsupdatedconfigatbeinningofthisspace + """
965
+ </div>
966
+ </div>""")
967
+
968
+
969
+ with gr.Accordion("Temporary Asset Management Assist - click to open", open=False):
970
+ gr.HTML("Make Files and Text ideas for the field and paste <br>When Space is restarted it will clear - zip export and import will be added later")
971
+ with gr.Accordion("Upload Files for config"):
972
+ 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/update the space - will add manual clear options later)")
973
+ with gr.Tab("Upload Files"):
974
+ file_input = gr.File(label="Choose File to Upload")
975
+ save_output = gr.Textbox(label="Upload Status")
976
+
977
+ with gr.Tab("File Explorer"):
978
+
979
+ file_explorer = gr.FileExplorer(
980
+ root_dir=SAVE_DIR,
981
+ glob="*.*",
982
+ file_count="single",
983
+ height=300,
984
+ label="Select a file to view"
985
+ )
986
+ with gr.Row():
987
+ refresh_button = gr.Button("Refresh", scale=1)
988
+ view_button = gr.Button("View File")
989
+ image_output = gr.Image(label="Image Output", type="pil")
990
+ audio_output = gr.Audio(label="Audio Output")
991
+ video_output = gr.Video(label="Video Output")
992
+ error_output = gr.Textbox(label="Error")
993
+
994
+ file_input.upload(
995
+ save_file,
996
+ inputs=file_input,
997
+ outputs=[save_output, file_explorer, file_input]
998
  )
999
+
1000
+ view_button.click(
1001
+ view_file,
1002
+ inputs=file_explorer,
1003
+ outputs=[image_output, audio_output, video_output, error_output]
1004
+ )
1005
+
1006
+ refresh_button.click(
1007
+ refresh_file_explorer,
1008
+ outputs=file_explorer
1009
+ )
1010
+
1011
+ with gr.Tab("Batch add files to config"):
1012
+ gr.HTML("Placeholder for Config parser to allow dropdowns for the media parts of the config inserted to make assigning media quick")
1013
+ gr.HTML("Placeholder for Config parser to allow for current zerospace creation and placement into the config (LLM can give list of media but still have to figure out workflow from there)")
1014
+
1015
+ gr.HTML("Placeholder for clearing uploaded assets (public space and temporary persistence = sharing and space problems)")
 
 
 
 
 
 
 
 
 
 
 
 
 
1016
 
1017
  with gr.Tab("Test and Edit Config"):
1018
  gr.HTML("The main issue is frequent changes add more chances for bugs in how - manual and auto refer mainly to ensuring correct JSON format ")
 
1159
  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])
1160
 
1161
  with gr.Tab("Asset Generation Considerations"):
1162
+ gr.HTML("Licenses for the spaces still to be evaluated - June 2024 <br> Users to follow with cool spaces - https://huggingface.co/jbilcke-hf, https://huggingface.co/dylanebert, https://huggingface.co/fffiloni, https://huggingface.co/artificialguybr, https://huggingface.co/radames, https://huggingface.co/multimodalart, ")
1163
 
1164
  with gr.Accordion("LLM HF Spaces/Sites (Click Here to Open) - Ask for a story and suggestions based on the autoconfig", open=False):
1165
  with gr.Row():
 
1372
  with gr.Tab("Other Considerations"):
1373
  with gr.Tab("General"):
1374
  gr.HTML("Experiment for https://huggingface.co/spaces/ysharma/open-interpreter/blob/main/app.py inplementation with gradio client api")
 
1375
 
1376
  gr.HTML("Useful Spaces and links: https://huggingface.co/spaces/artificialguybr/Stable-Audio-Open-Zero https://huggingface.co/spaces/stabilityai/TripoSR https://huggingface.co/spaces/wangfuyun/AnimateLCM-SVD https://huggingface.co/spaces/multimodalart/face-to-all https://huggingface.co/spaces/facebook/MusicGen https://huggingface.co/spaces/Doubiiu/tooncrafter")
1377
 
 
1386
  with gr.Tab("Finetuning options"):
1387
  gr.HTML("Price - https://openpipe.ai/pricing")
1388
  with gr.Tab("Backend and/or Hosting?"):
1389
+ gr.HTML("Deployemnt options - https://huggingface.co/SpacesExamples")
1390
  gr.HTML("Prototyping and freemium <br>free api <br>HF Pro subscription")
1391
  gr.HTML("GPU (Data privacy) = No Rate limits? - https://replicate.com/pricing, https://lambdalabs.com/service/gpu-cloud https://huggingface.co/pricing#endpoints https://tensordock.com/cloud-gpus")
1392
  gr.HTML("Speed - Groq, SambaNova, https://www.etched.com/announcing-etched ")