kwabs22 commited on
Commit
73be982
·
1 Parent(s): d8cee44

First edit test

Browse files
Files changed (1) hide show
  1. app.py +62 -58
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
- inventory_items = gr.State([])
39
- skills_items = gr.State([])
40
- objectives_items = gr.State([])
41
- targets_items = gr.State([])
42
-
43
- with gr.Tabs():
44
- with gr.TabItem("Inventory"):
45
- inventory_type = gr.Textbox(label="Type")
46
- inventory_name = gr.Textbox(label="Name")
47
- inventory_description = gr.Textbox(label="Description")
48
- add_inventory = gr.Button("Add Inventory Item")
49
- inventory_textbox = gr.JSON(label="Inventory Items", value=[])
50
-
51
- with gr.TabItem("Skills"):
52
- skills_branch = gr.Textbox(label="Branch")
53
- skills_name = gr.Textbox(label="Name")
54
- skills_learned = gr.Dropdown(choices=["True", "False"], label="Learned")
55
- add_skill_button = gr.Button("Add Skill")
56
- skills_textbox = gr.JSON(label="Skills", value=[])
57
-
58
- with gr.TabItem("Objectives"):
59
- objectives_id = gr.Textbox(label="ID")
60
- objectives_name = gr.Textbox(label="Name")
61
- objectives_complete = gr.Dropdown(choices=["True", "False"], label="Complete")
62
- add_objective_button = gr.Button("Add Objective")
63
- objectives_textbox = gr.JSON(label="Objectives", value=[])
64
-
65
- with gr.TabItem("Targets"):
66
- targets_name = gr.Textbox(label="Name")
67
- targets_x = gr.Textbox(label="X Coordinate")
68
- targets_y = gr.Textbox(label="Y Coordinate")
69
- targets_collisionType = gr.Textbox(label="Collision Type")
70
- targets_collisiontext = gr.Textbox(label="Collision Text")
71
- add_target_button = gr.Button("Add Target")
72
- targets_textbox = gr.JSON(label="Targets", value=[])
73
-
74
- config_output = gr.JSON(label="Updated Configuration")
75
-
76
- @gr.render(inputs=[inventory_items, skills_items, objectives_items, targets_items]) #, outputs=config_output)
77
- def aggregate_config(inventory, skills, objectives, targets):
78
- config = default_config.copy()
79
- config['inventory'] = inventory
80
- config['skills'] = skills
81
- config['objectives'] = objectives
82
- config['targets'] = targets
83
- return config
84
-
85
- add_inventory.click(add_inventory_item, inputs=[inventory_items, inventory_type, inventory_name, inventory_description], outputs=inventory_textbox)
86
- add_inventory.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
87
-
88
- add_skill_button.click(add_skill, inputs=[skills_items, skills_branch, skills_name, skills_learned], outputs=skills_textbox)
89
- add_skill_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
90
-
91
- add_objective_button.click(add_objective, inputs=[objectives_items, objectives_id, objectives_name, objectives_complete], outputs=objectives_textbox)
92
- add_objective_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
93
-
94
- add_target_button.click(add_target, inputs=[targets_items, targets_name, targets_x, targets_y, targets_collisionType, targets_collisiontext], outputs=targets_textbox)
95
- add_target_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
 
 
 
 
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()