Spaces:
Runtime error
Runtime error
kwabs22
commited on
Commit
·
585cfa0
1
Parent(s):
f03358b
Refactor Proto Assist accordion to absorb mess
Browse files
app.py
CHANGED
|
@@ -340,11 +340,11 @@ def show_elements_json_input(json_input):
|
|
| 340 |
outputs.append(transitions)
|
| 341 |
|
| 342 |
# New media field
|
| 343 |
-
media = gr.Textbox(label="Media", value=json.dumps(details
|
| 344 |
outputs.append(media)
|
| 345 |
|
| 346 |
# New developernotes field
|
| 347 |
-
developernotes = gr.Textbox(label="developernotes", value=json.dumps(details
|
| 348 |
outputs.append(developernotes)
|
| 349 |
|
| 350 |
#adding/removing a field means incrementing/decreasing the i+n to match the fields
|
|
@@ -363,15 +363,15 @@ def show_elements_json_input(json_input):
|
|
| 363 |
"developernotes": json.loads(current_values[i*num_current_unique_fields + 5])
|
| 364 |
}
|
| 365 |
updated_data["masterlocation1"]["end"] = masterlocation1["end"]
|
| 366 |
-
return json.dumps(updated_data,
|
| 367 |
|
| 368 |
update_button = gr.Button("Update JSON")
|
| 369 |
-
|
| 370 |
-
json_output_code = gr.Code(lines=10)
|
| 371 |
|
| 372 |
-
update_button.click(update_json, inputs=outputs, outputs=[
|
| 373 |
|
| 374 |
-
return outputs + [update_button,
|
| 375 |
|
| 376 |
def create_media_component(file_path):
|
| 377 |
print(file_path)
|
|
@@ -405,7 +405,9 @@ def convert_timeline_to_game_structure(timeline):
|
|
| 405 |
"description": "",
|
| 406 |
"events": [],
|
| 407 |
"choices": ["continue"],
|
| 408 |
-
"transitions": {}
|
|
|
|
|
|
|
| 409 |
}
|
| 410 |
else: # Continue with sub-locations or media entries
|
| 411 |
sub_location += 1
|
|
|
|
| 340 |
outputs.append(transitions)
|
| 341 |
|
| 342 |
# New media field
|
| 343 |
+
media = gr.Textbox(label="Media", value=json.dumps(details['media']), interactive=True)
|
| 344 |
outputs.append(media)
|
| 345 |
|
| 346 |
# New developernotes field
|
| 347 |
+
developernotes = gr.Textbox(label="developernotes", value=json.dumps(details['developernotes']), interactive=True)
|
| 348 |
outputs.append(developernotes)
|
| 349 |
|
| 350 |
#adding/removing a field means incrementing/decreasing the i+n to match the fields
|
|
|
|
| 363 |
"developernotes": json.loads(current_values[i*num_current_unique_fields + 5])
|
| 364 |
}
|
| 365 |
updated_data["masterlocation1"]["end"] = masterlocation1["end"]
|
| 366 |
+
return json.dumps(updated_data, indent=2), #json.dumps(updated_data, default=lambda o: o.__dict__, indent=2)
|
| 367 |
|
| 368 |
update_button = gr.Button("Update JSON")
|
| 369 |
+
json_output = gr.Textbox(label="Updated JSON", lines=10)
|
| 370 |
+
#json_output_code = gr.Code(lines=10) #file name error????
|
| 371 |
|
| 372 |
+
update_button.click(update_json, inputs=outputs, outputs=[json_output]) #, json_output_code]) #file name error????
|
| 373 |
|
| 374 |
+
return outputs + [update_button, json_output] #, json_output_code]
|
| 375 |
|
| 376 |
def create_media_component(file_path):
|
| 377 |
print(file_path)
|
|
|
|
| 405 |
"description": "",
|
| 406 |
"events": [],
|
| 407 |
"choices": ["continue"],
|
| 408 |
+
"transitions": {},
|
| 409 |
+
"media": [],
|
| 410 |
+
"developernotes": []
|
| 411 |
}
|
| 412 |
else: # Continue with sub-locations or media entries
|
| 413 |
sub_location += 1
|