Spaces:
Runtime error
Runtime error
File size: 12,232 Bytes
f27460e b19b854 73be982 b19b854 c6fa314 b19b854 c6fa314 b19b854 c6fa314 b19b854 c6fa314 b19b854 c6fa314 b19b854 c6fa314 b19b854 c6fa314 b19b854 c6fa314 b19b854 c6fa314 b19b854 c6fa314 b19b854 c6fa314 73be982 c6fa314 b19b854 c6fa314 b19b854 f27460e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
import gradio as gr
# Default configuration template
default_config = {
'background': '/AutoGameBackgrounds/1stGameLoc123.png',
'inventory': [],
'skills': [],
'objectives': [],
'targets': [],
'story': [],
'actions': {}
}
# Helper functions to dynamically add items
def add_inventory_item(inventory_items, type, name, description):
new_item = {"type": type, "name": name, "description": description}
inventory_items.append(new_item)
return inventory_items
def add_skill(skills_items, branch, name, learned):
new_skill = {"branch": branch, "name": name, "learned": learned == 'True'}
skills_items.append(new_skill)
return skills_items
def add_objective(objectives_items, id, name, complete):
new_objective = {"id": id, "name": name, "complete": complete == 'True'}
objectives_items.append(new_objective)
return objectives_items
def add_target(targets_items, name, x, y, collisionType, collisiontext):
new_target = {"name": name, "x": int(x), "y": int(y), "collisionType": collisionType, "collisiontext": collisiontext}
targets_items.append(new_target)
return targets_items
with gr.Blocks() as demo:
gr.HTML("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)")
gr.HTML("Main ideas for this space is: <br>A program exist around data <br>We can generate almost any media data and more <br>llms good at short questions <br>Time moves in a straight so all considerations are flattend by the nature of time <br>HF + Gradio allows for api use so this my prototype tool for tool use test")
with gr.Tab("Config Creator"):
with gr.Tab("Simple Config Creator"):
inventory_items = gr.State([])
skills_items = gr.State([])
objectives_items = gr.State([])
targets_items = gr.State([])
with gr.Tabs():
with gr.TabItem("Inventory"):
inventory_type = gr.Textbox(label="Type")
inventory_name = gr.Textbox(label="Name")
inventory_description = gr.Textbox(label="Description")
add_inventory = gr.Button("Add Inventory Item")
inventory_textbox = gr.JSON(label="Inventory Items", value=[])
with gr.TabItem("Skills"):
skills_branch = gr.Textbox(label="Branch")
skills_name = gr.Textbox(label="Name")
skills_learned = gr.Dropdown(choices=["True", "False"], label="Learned")
add_skill_button = gr.Button("Add Skill")
skills_textbox = gr.JSON(label="Skills", value=[])
with gr.TabItem("Objectives"):
objectives_id = gr.Textbox(label="ID")
objectives_name = gr.Textbox(label="Name")
objectives_complete = gr.Dropdown(choices=["True", "False"], label="Complete")
add_objective_button = gr.Button("Add Objective")
objectives_textbox = gr.JSON(label="Objectives", value=[])
with gr.TabItem("Targets"):
targets_name = gr.Textbox(label="Name")
targets_x = gr.Textbox(label="X Coordinate")
targets_y = gr.Textbox(label="Y Coordinate")
targets_collisionType = gr.Textbox(label="Collision Type")
targets_collisiontext = gr.Textbox(label="Collision Text")
add_target_button = gr.Button("Add Target")
targets_textbox = gr.JSON(label="Targets", value=[])
with gr.TabItem("Placeholders for Modal Target"):
gr.HTML("Placeholder")
with gr.TabItem("Placeholders for State Machine Modal Target"):
gr.HTML("Placeholder")
with gr.TabItem("Placeholders for Background"):
gr.HTML("Placeholder")
config_output = gr.JSON(label="Updated Configuration")
@gr.render(inputs=[inventory_items, skills_items, objectives_items, targets_items]) #, outputs=config_output)
def aggregate_config(inventory, skills, objectives, targets):
config = default_config.copy()
config['inventory'] = inventory
config['skills'] = skills
config['objectives'] = objectives
config['targets'] = targets
return config
add_inventory.click(add_inventory_item, inputs=[inventory_items, inventory_type, inventory_name, inventory_description], outputs=inventory_textbox)
add_inventory.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
add_skill_button.click(add_skill, inputs=[skills_items, skills_branch, skills_name, skills_learned], outputs=skills_textbox)
add_skill_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
add_objective_button.click(add_objective, inputs=[objectives_items, objectives_id, objectives_name, objectives_complete], outputs=objectives_textbox)
add_objective_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
add_target_button.click(add_target, inputs=[targets_items, targets_name, targets_x, targets_y, targets_collisionType, targets_collisiontext], outputs=targets_textbox)
add_target_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
with gr.Tab("Advanced Config Creator"):
gr.HTML("")
with gr.Tab("Skeleton and Asset Generation"):
gr.HTML("With some ideas from gemini-1.5-flash-api-0514 and reka-flash-preview-20240611")
with gr.Tab("Skeleton Generator"):
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
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")
with gr.Tab("Save files"):
gr.HTML("For Dynamic events overnight or when player is not active what can LLMS edit? <br><br>eg. Waiting for a letter from a random npc can be decided by the llm <br>eg. Improved Stats on certain days (eg. bitrthday) <br>Privacy <br>User Directed DLC eg. Rockstar Editor with local llm guide")
gr.HTML("Placeholder for huggingface spaces that can assist ")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist (9b and under) <br>initial floor for testing can be https://huggingface.co/spaces/Qwen/Qwen2-0.5B-Instruct, https://huggingface.co/spaces/Qwen/Qwen2-1.5b-instruct-demo, https://huggingface.co/spaces/stabilityai/stablelm-2-1_6b-zephyr, https://huggingface.co/spaces/IndexTeam/Index-1.9B, ")
with gr.Tab("Images"):
gr.HTML("Concept Art, UI elements, Static/3D Characters, Environments and Objects")
gr.HTML("Image Caption = https://huggingface.co/spaces/microsoft/Promptist, https://huggingface.co/spaces/gokaygokay/SD3-Long-Captioner, https://huggingface.co/spaces/gokaygokay/Florence-2, ")
gr.HTML("Images Generation Portraits = https://huggingface.co/spaces/okaris/omni-zero")
gr.HTML("Images Generation General = ")
gr.HTML("Images Generation Posters with text - https://huggingface.co/spaces/GlyphByT5/Glyph-SDXL-v2")
gr.HTML("Placeholder for huggingface spaces that can assist <br> https://huggingface.co/spaces/gokaygokay/Florence-2 <br>")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Audio"):
gr.HTML("Music - Background, Interactive, Cutscene, Menu <br>Sound Effects - Environment, character, action (environmental triggered by user eg. gun), UI <br>Speech - Dialouge, narration, voiceover <br>The new render function means the Config can be made and iframe/api functions can be ordered as neccessary based on the part of the config that needs it to streamline workflows based on current state of config ")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Audio Sound Effects - https://huggingface.co/spaces/artificialguybr/Stable-Audio-Open-Zero")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Video"):
gr.HTML("Cutscenes, Tutorials, Trailers")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("3D"):
gr.HTML("Characters, Environments, Objects")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Animations (for lower resource use)"):
gr.HTML("Characters, Environments, Objects")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Fonts"):
gr.HTML("Style of whole game, or locations, or characters")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Shaders and related"):
gr.HTML("Post-processing Effects, material effects, Particle systems, visual feedback")
gr.HTML("Visual Effects - eg. explosion can turn all items white for a moment, losing conciousness blurs whole screen")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Other Considerations"):
with gr.Tab("General"):
gr.HTML("Experiment for https://huggingface.co/spaces/ysharma/open-interpreter/blob/main/app.py inplementation with gradio client api")
gr.HTML("Some conderations for future integration: https://huggingface.co/spaces/dylanebert/3d-arena, https://github.com/fudan-generative-vision/hallo")
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")
gr.HTML("https://huggingface.co/spaces/linoyts/scribble-sdxl-flash as map planner")
gr.HTML("---------------------------------------Gameplay Ideas-------------------------------")
gr.HTML("https://huggingface.co/spaces/Lin-Chen/ShareCaptioner-Video - game use example police questions a event with multiple eye witnesses needs to give as close to the caption description to win")
with gr.Tab("Backend and/or Hosting?"):
gr.HTML("Prototyping and freemium <br>free api <br>HF Pro subscription")
gr.HTML("GPU (Data privacy) = No Rate limits? - https://lambdalabs.com/service/gpu-cloud https://huggingface.co/pricing#endpoints")
gr.HTML("Speed - Groq, SambaNova, ")
gr.HTML("Price - Coding - https://www.deepseek.com/ 0.3 per million")
demo.launch()
|