kwabs22 commited on
Commit
7522136
·
1 Parent(s): 932fd0e

Response is generator fix and other polish

Browse files
Files changed (1) hide show
  1. app.py +150 -152
app.py CHANGED
@@ -786,64 +786,78 @@ with gr.Blocks() as demo:
786
  </div>""")
787
 
788
  with gr.Accordion("Config and Asset Assistance - Click to open", open=False):
789
- with gr.Accordion("Themes to consider before you attempt config", open=False):
790
  gr.HTML("Copy paste any old config to llm and ask to remix is the easiest <br>To bake 'Moral of the story' in you have to be very deliberate")
791
  gr.HTML("UI can be media and all items can have media")
792
- with gr.Accordion("Qwen 0.5B as Space Guide Tests", open=False):
793
- with gr.Tab("General FAQ Attempt"):
794
- FAQMainOutput = gr.TextArea(placeholder='Output will show here', value='')
795
- FAQCustomButtonInput = gr.TextArea(lines=1, placeholder='Prompt goes here')
796
-
797
- for category_name, category_prompts in FAQAllprompts.items():
798
- with gr.Accordion(f"General {category_name} Pattern based", open=False):
799
- with gr.Group():
800
- for index, (prompt, _) in enumerate(category_prompts):
801
- button = gr.Button(prompt)
802
- button.click(llmguide_generate_response, inputs=[FAQCustomButtonInput, gr.State(index), gr.State(category_name)], outputs=FAQMainOutput)
803
-
804
- with gr.Tab("General RAG (Pathfinder?) Attempt"):
805
- gr.HTML("https://huggingface.co/spaces/mteb/leaderboard - Source for SOTA - current using all-MiniLM-L6-v2")
806
- gr.HTML("Placeholder for weak RAG Type Charcter interaction test aka input for JSON 'Knowledge Base' Input")
807
- gr.Interface(
808
- fn=process_query,
809
- inputs=[
810
- gr.Textbox(lines=2, placeholder="Enter your question here..."),
811
- gr.Checkbox(label="Use RAG"),
812
- gr.Checkbox(label="Stream output")
813
- ],
814
- outputs=[
815
- gr.Textbox(label="Generated Response"),
816
- gr.Textbox(label="Tokens per second"),
817
- gr.Textbox(label="RAM Usage"),
818
- gr.Textbox(label="Referenced Documents")
819
- ],
820
- title="RAG/Non-RAG Q&A System",
821
- 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."
822
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
823
 
824
- with gr.Tab("Any Request to Qwen2-0.5B"):
825
- gr.HTML("Placeholder for https://huggingface.co/h2oai/h2o-danube3-500m-chat-GGUF and https://huggingface.co/OuteAI/Lite-Mistral-150M-v2-Instruct as alternative")
826
- gr.HTML("https://huggingface.co/spaces/HuggingFaceTB/SmolLM-135M-Instruct-WebGPU 125 mdeol to be tested as alternative (and all up to 1.5b - how to delte a model in your code?) - Need to go over the dataset to see how to prompt it - https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus ")
827
- gr.HTML("Placeholder for qwen 2 72b as alternative use checkbox and gradio client api call")
828
- gr.Markdown("# Qwen-0.5B-Instruct Language Model")
829
- gr.Markdown("This demo uses the Qwen-0.5B-Instruct model to generate responses based on your input.")
830
- 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")
831
-
832
- with gr.Row():
833
- with gr.Column():
834
- llmguide_prompt = gr.Textbox(lines=2, placeholder="Enter your prompt here...")
835
- llmguide_stream_checkbox = gr.Checkbox(label="Enable streaming")
836
- llmguide_submit_button = gr.Button("Generate")
837
-
838
- with gr.Column():
839
- llmguide_output = gr.Textbox(lines=10, label="Generated Response")
840
- llmguide_tokens_per_second = gr.Textbox(label="Tokens per Second")
841
 
842
- llmguide_submit_button.click(
843
- llmguide_generate_response,
844
- inputs=[llmguide_prompt, llmguide_stream_checkbox],
845
- outputs=[llmguide_output, llmguide_tokens_per_second],
846
- )
 
 
 
 
847
 
848
  with gr.Accordion("New Config Proto Assist - Trying to abstract the process into one worflow is beyond me so multiple paths to goal (config) is the aim now", open=False):
849
  with gr.Tab("Linear - List to Empty Config with Edit support"):
@@ -905,8 +919,11 @@ with gr.Blocks() as demo:
905
  prev_msgs.append(prompt)
906
  formatted_prompt = LinPEWFformat_prompt(prompt, prev_msgs)
907
  response = llmguide_generate_response(formatted_prompt)
908
- prev_msgs.append(f"Response: {response}")
909
- return response
 
 
 
910
 
911
  outputbtn = gr.Button(f"Generate {i}").click(
912
  fn=LinPEWF_update_and_generate,
@@ -920,6 +937,7 @@ with gr.Blocks() as demo:
920
  #with gr.Accordion("Decisions / Timeline Creation to Story to Config Conversation", open=False):
921
  with gr.Tab("Branching - Decisions / Timeline Creation to Story to Config Conversation"):
922
  gr.HTML("Structures for interesting timeline progression")
 
923
  gr.HTML("Placeholder - Considerations - Story from the perspective of Main character or NPC in the LLM genereated story")
924
  mermaideditoriframebtn = gr.Button("Load Mermaid Editor")
925
  mermaideditoriframe = gr.HTML("")
@@ -927,24 +945,6 @@ with gr.Blocks() as demo:
927
  with gr.Accordion("Mermaid Structures - click to open", open=False):
928
  for key, item in mermaidstorystructures.items():
929
  gr.Code(item, label=key)
930
-
931
- with gr.Accordion("Old Ideas to merge", open=False):
932
- gr.HTML("Random Scenario / Song to 'full game' manual or auto is end goal ")
933
- 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)")
934
- 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) ")
935
- gr.HTML("Existing Game Rules for text - Cyberpunk RED, ")
936
- 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")
937
- gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
938
- 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")
939
- with gr.Tab("Main areas of considerations"):
940
- with gr.Tab("Mermaid Graphs and Nesting"):
941
- 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> ")
942
- gr.HTML("")
943
- with gr.Tab("Structural Inspirations"):
944
- gr.HTML("GTA Heists - Replayability and stakes, Tekken - 2/3 mistakes = lost round ")
945
- gr.HTML("Sports Scores, ")
946
- with gr.Tab("Themes"):
947
- gr.HTML("")
948
 
949
  with gr.Accordion("Existing Config Crafting Progression - click to open", open=False):
950
  with gr.Accordion("Test for config to gradio components order - ignore for now", open=False ):
@@ -1050,83 +1050,81 @@ Creating more diverse paths through the game""")
1050
  with gr.Tab(experimetal_config_name):
1051
  gr.Code(json.dumps(experimetal_config, default=lambda o: o.__dict__, indent=2), label=experimetal_config_name) #str(experimetal_config)
1052
 
1053
- with gr.Tab("Test and Edit Config"):
1054
- 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 ")
1055
- with gr.Tab("Full Manual - Test Example State Machine"):
1056
- with gr.Tab("Config Without Assets"):
1057
- with gr.Row():
1058
- with gr.Column(scale=2):
1059
- gr.Markdown("# Text-based Adventure Game")
1060
-
1061
- description = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
1062
- choices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
1063
- submit_btn = gr.Button("Make Choice")
1064
- game_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
1065
- game_session = gr.State(value=initgameinfo[3])
1066
- submit_btn.click(
1067
- make_choice,
1068
- inputs=[choices, game_session],
1069
- outputs=[description, choices, game_log, game_session]
 
 
 
 
 
 
 
 
 
 
1070
  )
1071
- with gr.Column(scale=1):
1072
- gr.Markdown("# Debugging")
1073
- error_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
1074
- with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
1075
- custom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
1076
- custom_configbtn = gr.Button("Load Custom Config")
1077
-
1078
- custom_configbtn.click(
1079
- load_game,
1080
- inputs=[custom_config],
1081
- outputs=[error_box, game_log, description, choices, game_session, custom_config]
1082
- )
1083
- with gr.Tab("Config With Assets"):
1084
- gr.HTML("Placeholder as not complete yet (still only text, current issue is how to switch gradio output, maybe output is gr.Group and we constantly add the appropriate gr for each file type? What about multi file types on one state?)")
1085
- with gr.Row():
1086
- with gr.Column(scale=2):
1087
- gr.Markdown("# Text-based Adventure Game")
1088
-
1089
- wadescription = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
1090
- wamediabool = gr.State(value=True)
1091
- wamedia = gr.State(["testmedia/Stable Audio - Raindrops, output.wav"])
1092
-
1093
- @gr.render(inputs=wamedia)
1094
- def dynamic_with_media(media_items):
1095
- print(media_items)
1096
- with gr.Group() as wamediagrouping:
1097
- gr.HTML("Placeholder to load all media tests - still need to test clearing media on ")
1098
- if media_items == []:
1099
- gr.Markdown("No media items to display.")
1100
- else:
1101
- for item in media_items:
1102
- render = create_media_component(item)
1103
-
1104
- return wamediagrouping
1105
 
1106
- wachoices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
1107
- wasubmit_btn = gr.Button("Make Choice")
1108
- wagame_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
1109
- wagame_session = gr.State(value=initgameinfo[3])
1110
- wasubmit_btn.click(
1111
- make_choice,
1112
- inputs=[wachoices, wagame_session, wamediabool],
1113
- outputs=[wadescription, wachoices, wagame_log, wagame_session, wamedia]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1114
  )
1115
- with gr.Column(scale=1):
1116
- gr.Markdown("# Debugging")
1117
- waerror_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
1118
- with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
1119
- wacustom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
1120
- wacustom_configbtn = gr.Button("Load Custom Config")
1121
-
1122
- wacustom_configbtn.click(
1123
- load_game,
1124
- inputs=[wacustom_config, wamediabool],
1125
- outputs=[waerror_box, wagame_log, wadescription, wachoices, wacustom_config, wagame_session, wamedia]
1126
- )
1127
-
1128
- with gr.Tab("Config With Minimal 3D considered"):
1129
- gr.HTML("Placeholder for Config with 3D assets")
1130
 
1131
  with gr.Tab("Semi-Auto - Edit config while playing game"):
1132
  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")
@@ -1336,9 +1334,8 @@ Creating more diverse paths through the game""")
1336
 
1337
  with gr.Tab("Basic Game Engine Mechanics"):
1338
  gr.HTML("Placeholder for explanations of Player and Game Session")
1339
-
1340
- with gr.Tab("LLM play testing"):
1341
- gr.HTML("LLM can read the contents in full and give critiques but they can also play the game if you make a api interface - gradio allows this in the form of gradio client but you can also reroute the user inputs to function calling")
1342
 
1343
  with gr.Tab("Custom JS Config Creator"):
1344
  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)")
@@ -1414,8 +1411,9 @@ Creating more diverse paths through the game""")
1414
  with gr.Tab("Advanced Config Creator"):
1415
  gr.HTML("Config with More than text and images")
1416
 
1417
- with gr.Tab("LLM/Robotics as custom controllers Considerations"):
1418
  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)")
 
1419
  gr.HTML("Robotics - https://github.com/OpenTeleVision/TeleVision https://www.stereolabs.com/")
1420
 
1421
  with gr.Tab("Other Considerations"):
 
786
  </div>""")
787
 
788
  with gr.Accordion("Config and Asset Assistance - Click to open", open=False):
789
+ with gr.Accordion("Guidance / Themes to consider before you attempt config (Currently Qwen 0.5B)", open=False):
790
  gr.HTML("Copy paste any old config to llm and ask to remix is the easiest <br>To bake 'Moral of the story' in you have to be very deliberate")
791
  gr.HTML("UI can be media and all items can have media")
792
+ with gr.Accordion("Old Ideas to merge", open=False):
793
+ gr.HTML("Random Scenario / Song to 'full game' manual or auto is end goal ")
794
+ 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)")
795
+ 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) ")
796
+ gr.HTML("Existing Game Rules for text - Cyberpunk RED, ")
797
+ 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")
798
+ gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
799
+ 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")
800
+ with gr.Tab("Main areas of considerations"):
801
+ gr.HTML("")
802
+ with gr.Tab("Structural Inspirations"):
803
+ gr.HTML("GTA Heists - Replayability and stakes, Tekken - 2/3 mistakes = lost round ")
804
+ gr.HTML("Sports Scores, ")
805
+ with gr.Tab("Themes"):
806
+ gr.HTML("")
807
+ with gr.Tab("General FAQ Attempt"):
808
+ FAQMainOutput = gr.TextArea(placeholder='Output will show here', value='')
809
+ FAQCustomButtonInput = gr.TextArea(lines=1, placeholder='Prompt goes here')
810
+
811
+ for category_name, category_prompts in FAQAllprompts.items():
812
+ with gr.Accordion(f"General {category_name} Pattern based", open=False):
813
+ with gr.Group():
814
+ for index, (prompt, _) in enumerate(category_prompts):
815
+ button = gr.Button(prompt)
816
+ button.click(llmguide_generate_response, inputs=[FAQCustomButtonInput, gr.State(index), gr.State(category_name)], outputs=FAQMainOutput)
817
+
818
+ with gr.Tab("General RAG (Pathfinder?) Attempt"):
819
+ gr.HTML("https://huggingface.co/spaces/mteb/leaderboard - Source for SOTA - current using all-MiniLM-L6-v2")
820
+ gr.HTML("Placeholder for weak RAG Type Charcter interaction test aka input for JSON 'Knowledge Base' Input")
821
+ gr.Interface(
822
+ fn=process_query,
823
+ inputs=[
824
+ gr.Textbox(lines=2, placeholder="Enter your question here..."),
825
+ gr.Checkbox(label="Use RAG"),
826
+ gr.Checkbox(label="Stream output")
827
+ ],
828
+ outputs=[
829
+ gr.Textbox(label="Generated Response"),
830
+ gr.Textbox(label="Tokens per second"),
831
+ gr.Textbox(label="RAM Usage"),
832
+ gr.Textbox(label="Referenced Documents")
833
+ ],
834
+ title="RAG/Non-RAG Q&A System",
835
+ 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."
836
+ )
837
 
838
+ with gr.Tab("Any Request to Qwen2-0.5B"):
839
+ gr.HTML("Placeholder for https://huggingface.co/h2oai/h2o-danube3-500m-chat-GGUF and https://huggingface.co/OuteAI/Lite-Mistral-150M-v2-Instruct as alternative")
840
+ gr.HTML("https://huggingface.co/spaces/HuggingFaceTB/SmolLM-135M-Instruct-WebGPU 125 mdeol to be tested as alternative (and all up to 1.5b - how to delte a model in your code?) - Need to go over the dataset to see how to prompt it - https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus ")
841
+ gr.HTML("Placeholder for qwen 2 72b as alternative use checkbox and gradio client api call")
842
+ gr.Markdown("# Qwen-0.5B-Instruct Language Model")
843
+ gr.Markdown("This demo uses the Qwen-0.5B-Instruct model to generate responses based on your input.")
844
+ 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")
845
+
846
+ with gr.Row():
847
+ with gr.Column():
848
+ llmguide_prompt = gr.Textbox(lines=2, placeholder="Enter your prompt here...")
849
+ llmguide_stream_checkbox = gr.Checkbox(label="Enable streaming")
850
+ llmguide_submit_button = gr.Button("Generate")
 
 
 
 
851
 
852
+ with gr.Column():
853
+ llmguide_output = gr.Textbox(lines=10, label="Generated Response")
854
+ llmguide_tokens_per_second = gr.Textbox(label="Tokens per Second")
855
+
856
+ llmguide_submit_button.click(
857
+ llmguide_generate_response,
858
+ inputs=[llmguide_prompt, llmguide_stream_checkbox],
859
+ outputs=[llmguide_output, llmguide_tokens_per_second],
860
+ )
861
 
862
  with gr.Accordion("New Config Proto Assist - Trying to abstract the process into one worflow is beyond me so multiple paths to goal (config) is the aim now", open=False):
863
  with gr.Tab("Linear - List to Empty Config with Edit support"):
 
919
  prev_msgs.append(prompt)
920
  formatted_prompt = LinPEWFformat_prompt(prompt, prev_msgs)
921
  response = llmguide_generate_response(formatted_prompt)
922
+ full_response = ""
923
+ for chunk in response:
924
+ full_response += chunk
925
+ prev_msgs.append(f"Response: {full_response}")
926
+ return full_response
927
 
928
  outputbtn = gr.Button(f"Generate {i}").click(
929
  fn=LinPEWF_update_and_generate,
 
937
  #with gr.Accordion("Decisions / Timeline Creation to Story to Config Conversation", open=False):
938
  with gr.Tab("Branching - Decisions / Timeline Creation to Story to Config Conversation"):
939
  gr.HTML("Structures for interesting timeline progression")
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("Placeholder - Considerations - Story from the perspective of Main character or NPC in the LLM genereated story")
942
  mermaideditoriframebtn = gr.Button("Load Mermaid Editor")
943
  mermaideditoriframe = gr.HTML("")
 
945
  with gr.Accordion("Mermaid Structures - click to open", open=False):
946
  for key, item in mermaidstorystructures.items():
947
  gr.Code(item, label=key)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948
 
949
  with gr.Accordion("Existing Config Crafting Progression - click to open", open=False):
950
  with gr.Accordion("Test for config to gradio components order - ignore for now", open=False ):
 
1050
  with gr.Tab(experimetal_config_name):
1051
  gr.Code(json.dumps(experimetal_config, default=lambda o: o.__dict__, indent=2), label=experimetal_config_name) #str(experimetal_config)
1052
 
1053
+ with gr.Tab("Test and Edit Config"):
1054
+ with gr.Tab("Manual - Config Without Assets"):
1055
+ with gr.Row():
1056
+ with gr.Column(scale=2):
1057
+ gr.Markdown("# Text-based Adventure Game")
1058
+
1059
+ description = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
1060
+ choices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
1061
+ submit_btn = gr.Button("Make Choice")
1062
+ game_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
1063
+ game_session = gr.State(value=initgameinfo[3])
1064
+ submit_btn.click(
1065
+ make_choice,
1066
+ inputs=[choices, game_session],
1067
+ outputs=[description, choices, game_log, game_session]
1068
+ )
1069
+ with gr.Column(scale=1):
1070
+ gr.Markdown("# Debugging")
1071
+ error_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
1072
+ with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
1073
+ custom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
1074
+ custom_configbtn = gr.Button("Load Custom Config")
1075
+
1076
+ custom_configbtn.click(
1077
+ load_game,
1078
+ inputs=[custom_config],
1079
+ outputs=[error_box, game_log, description, choices, game_session, custom_config]
1080
  )
1081
+ with gr.Tab("Manual - Config With Assets"):
1082
+ gr.HTML("Placeholder as not complete yet (still only text, current issue is how to switch gradio output, maybe output is gr.Group and we constantly add the appropriate gr for each file type? What about multi file types on one state?)")
1083
+ with gr.Row():
1084
+ with gr.Column(scale=2):
1085
+ gr.Markdown("# Text-based Adventure Game")
1086
+
1087
+ wadescription = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
1088
+ wamediabool = gr.State(value=True)
1089
+ wamedia = gr.State(["testmedia/Stable Audio - Raindrops, output.wav"])
1090
+
1091
+ @gr.render(inputs=wamedia)
1092
+ def dynamic_with_media(media_items):
1093
+ print(media_items)
1094
+ with gr.Group() as wamediagrouping:
1095
+ gr.HTML("Placeholder to load all media tests - still need to test clearing media on ")
1096
+ if media_items == []:
1097
+ gr.Markdown("No media items to display.")
1098
+ else:
1099
+ for item in media_items:
1100
+ render = create_media_component(item)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1101
 
1102
+ return wamediagrouping
1103
+
1104
+ wachoices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
1105
+ wasubmit_btn = gr.Button("Make Choice")
1106
+ wagame_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
1107
+ wagame_session = gr.State(value=initgameinfo[3])
1108
+ wasubmit_btn.click(
1109
+ make_choice,
1110
+ inputs=[wachoices, wagame_session, wamediabool],
1111
+ outputs=[wadescription, wachoices, wagame_log, wagame_session, wamedia]
1112
+ )
1113
+ with gr.Column(scale=1):
1114
+ gr.Markdown("# Debugging")
1115
+ waerror_box = gr.Textbox(label="Path Errors", lines=4, value=path_errors)
1116
+ with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
1117
+ wacustom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
1118
+ wacustom_configbtn = gr.Button("Load Custom Config")
1119
+
1120
+ wacustom_configbtn.click(
1121
+ load_game,
1122
+ inputs=[wacustom_config, wamediabool],
1123
+ outputs=[waerror_box, wagame_log, wadescription, wachoices, wacustom_config, wagame_session, wamedia]
1124
  )
1125
+
1126
+ with gr.Tab("Manual - Config With Minimal 3D considered"):
1127
+ gr.HTML("Placeholder for Config with 3D assets")
 
 
 
 
 
 
 
 
 
 
 
 
1128
 
1129
  with gr.Tab("Semi-Auto - Edit config while playing game"):
1130
  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")
 
1334
 
1335
  with gr.Tab("Basic Game Engine Mechanics"):
1336
  gr.HTML("Placeholder for explanations of Player and Game Session")
1337
+ with gr.Tab("LLM play testing"):
1338
+ gr.HTML("LLM can read the contents in full and give critiques but they can also play the game if you make a api interface - gradio allows this in the form of gradio client but you can also reroute the user inputs to function calling")
 
1339
 
1340
  with gr.Tab("Custom JS Config Creator"):
1341
  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)")
 
1411
  with gr.Tab("Advanced Config Creator"):
1412
  gr.HTML("Config with More than text and images")
1413
 
1414
+ with gr.Tab("LLM/Robotics as custom controllers"):
1415
  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)")
1416
+ gr.HTML("https://huggingface.co/posts/thomwolf/809364796644704")
1417
  gr.HTML("Robotics - https://github.com/OpenTeleVision/TeleVision https://www.stereolabs.com/")
1418
 
1419
  with gr.Tab("Other Considerations"):