Spaces:
Runtime error
Runtime error
kwabs22
commited on
Commit
·
73be982
1
Parent(s):
d8cee44
First edit test
Browse files
app.py
CHANGED
|
@@ -35,63 +35,67 @@ def add_target(targets_items, name, x, y, collisionType, collisiontext):
|
|
| 35 |
with gr.Blocks() as demo:
|
| 36 |
gr.HTML("Companion Space for zerogpu workflow planning for a way to send a zip to the Basic Game Engine at the bottom of https://huggingface.co/spaces/KwabsHug/TestSvelteStatic")
|
| 37 |
gr.HTML("Some conderations for future integration: https://huggingface.co/spaces/dylanebert/3d-arena, https://github.com/fudan-generative-vision/hallo")
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
with gr.
|
| 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 |
demo.launch()
|
|
|
|
| 35 |
with gr.Blocks() as demo:
|
| 36 |
gr.HTML("Companion Space for zerogpu workflow planning for a way to send a zip to the Basic Game Engine at the bottom of https://huggingface.co/spaces/KwabsHug/TestSvelteStatic")
|
| 37 |
gr.HTML("Some conderations for future integration: https://huggingface.co/spaces/dylanebert/3d-arena, https://github.com/fudan-generative-vision/hallo")
|
| 38 |
+
with gr.Tab("Config Creator"):
|
| 39 |
+
inventory_items = gr.State([])
|
| 40 |
+
skills_items = gr.State([])
|
| 41 |
+
objectives_items = gr.State([])
|
| 42 |
+
targets_items = gr.State([])
|
| 43 |
+
|
| 44 |
+
with gr.Tabs():
|
| 45 |
+
with gr.TabItem("Inventory"):
|
| 46 |
+
inventory_type = gr.Textbox(label="Type")
|
| 47 |
+
inventory_name = gr.Textbox(label="Name")
|
| 48 |
+
inventory_description = gr.Textbox(label="Description")
|
| 49 |
+
add_inventory = gr.Button("Add Inventory Item")
|
| 50 |
+
inventory_textbox = gr.JSON(label="Inventory Items", value=[])
|
| 51 |
+
|
| 52 |
+
with gr.TabItem("Skills"):
|
| 53 |
+
skills_branch = gr.Textbox(label="Branch")
|
| 54 |
+
skills_name = gr.Textbox(label="Name")
|
| 55 |
+
skills_learned = gr.Dropdown(choices=["True", "False"], label="Learned")
|
| 56 |
+
add_skill_button = gr.Button("Add Skill")
|
| 57 |
+
skills_textbox = gr.JSON(label="Skills", value=[])
|
| 58 |
+
|
| 59 |
+
with gr.TabItem("Objectives"):
|
| 60 |
+
objectives_id = gr.Textbox(label="ID")
|
| 61 |
+
objectives_name = gr.Textbox(label="Name")
|
| 62 |
+
objectives_complete = gr.Dropdown(choices=["True", "False"], label="Complete")
|
| 63 |
+
add_objective_button = gr.Button("Add Objective")
|
| 64 |
+
objectives_textbox = gr.JSON(label="Objectives", value=[])
|
| 65 |
+
|
| 66 |
+
with gr.TabItem("Targets"):
|
| 67 |
+
targets_name = gr.Textbox(label="Name")
|
| 68 |
+
targets_x = gr.Textbox(label="X Coordinate")
|
| 69 |
+
targets_y = gr.Textbox(label="Y Coordinate")
|
| 70 |
+
targets_collisionType = gr.Textbox(label="Collision Type")
|
| 71 |
+
targets_collisiontext = gr.Textbox(label="Collision Text")
|
| 72 |
+
add_target_button = gr.Button("Add Target")
|
| 73 |
+
targets_textbox = gr.JSON(label="Targets", value=[])
|
| 74 |
+
|
| 75 |
+
config_output = gr.JSON(label="Updated Configuration")
|
| 76 |
+
|
| 77 |
+
@gr.render(inputs=[inventory_items, skills_items, objectives_items, targets_items]) #, outputs=config_output)
|
| 78 |
+
def aggregate_config(inventory, skills, objectives, targets):
|
| 79 |
+
config = default_config.copy()
|
| 80 |
+
config['inventory'] = inventory
|
| 81 |
+
config['skills'] = skills
|
| 82 |
+
config['objectives'] = objectives
|
| 83 |
+
config['targets'] = targets
|
| 84 |
+
return config
|
| 85 |
+
|
| 86 |
+
add_inventory.click(add_inventory_item, inputs=[inventory_items, inventory_type, inventory_name, inventory_description], outputs=inventory_textbox)
|
| 87 |
+
add_inventory.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
|
| 88 |
+
|
| 89 |
+
add_skill_button.click(add_skill, inputs=[skills_items, skills_branch, skills_name, skills_learned], outputs=skills_textbox)
|
| 90 |
+
add_skill_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
|
| 91 |
+
|
| 92 |
+
add_objective_button.click(add_objective, inputs=[objectives_items, objectives_id, objectives_name, objectives_complete], outputs=objectives_textbox)
|
| 93 |
+
add_objective_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
|
| 94 |
+
|
| 95 |
+
add_target_button.click(add_target, inputs=[targets_items, targets_name, targets_x, targets_y, targets_collisionType, targets_collisiontext], outputs=targets_textbox)
|
| 96 |
+
add_target_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
|
| 97 |
+
|
| 98 |
+
with gr.Tab("Other Considerations"):
|
| 99 |
+
gr.HTML("Useful Spaces and links")
|
| 100 |
|
| 101 |
demo.launch()
|