Spaces:
Runtime error
Runtime error
kwabs22
commited on
Commit
·
ed49cfb
1
Parent(s):
66774ee
editing placeholder debug
Browse files
app.py
CHANGED
|
@@ -84,9 +84,9 @@ def create_story(timeline):
|
|
| 84 |
story.append(f"The player interacted with {entry[2]}.")
|
| 85 |
return " ".join(story)
|
| 86 |
|
| 87 |
-
def generate_story_and_timeline(
|
| 88 |
# Pick 10 random UI items
|
| 89 |
-
random_ui_items = pick_random_items(player_engagement_items,
|
| 90 |
|
| 91 |
# Generate UI and story timelines
|
| 92 |
ui_timeline = generate_timeline(random_ui_items, "UI")
|
|
@@ -100,7 +100,7 @@ def generate_story_and_timeline(no_timeline_points=10, include_media=True):
|
|
| 100 |
|
| 101 |
# Include media-related items if specified
|
| 102 |
if include_media:
|
| 103 |
-
media_files = generate_media_file_list(
|
| 104 |
#rendered_media = render_media_with_dropdowns(media_files)
|
| 105 |
media_timeline = generate_timeline(media_files, "Media")
|
| 106 |
merged_timeline += media_timeline
|
|
@@ -262,16 +262,16 @@ def show_elements_json_input(json_input):
|
|
| 262 |
continue
|
| 263 |
|
| 264 |
with gr.Accordion(f"Location: {location}"):
|
| 265 |
-
description = gr.Textbox(label="Description", value=details['description'])
|
| 266 |
outputs.append(description)
|
| 267 |
|
| 268 |
-
events = gr.Textbox(label="Events", value=json.dumps(details['events']))
|
| 269 |
outputs.append(events)
|
| 270 |
|
| 271 |
-
choices = gr.Textbox(label="Choices", value=json.dumps(details['choices']))
|
| 272 |
outputs.append(choices)
|
| 273 |
|
| 274 |
-
transitions = gr.Textbox(label="Transitions", value=json.dumps(details['transitions']))
|
| 275 |
outputs.append(transitions)
|
| 276 |
|
| 277 |
def update_json():
|
|
@@ -608,39 +608,43 @@ with gr.Blocks() as demo:
|
|
| 608 |
<div style="width: 20%; text-align: center">HF + Gradio allows for api use so this my prototype tool for tool use test</div>
|
| 609 |
</div>""")
|
| 610 |
with gr.Tab("Skeleton Generator"):
|
| 611 |
-
gr.
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
gr.
|
| 615 |
-
|
| 616 |
-
gr.
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
with gr.
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
@gr.render(inputs=input_text)
|
| 642 |
-
def update(text):
|
| 643 |
-
return show_elements(text)
|
| 644 |
|
| 645 |
with gr.Tab("Test Example State Machine"):
|
| 646 |
with gr.Tab("Config Without Assets"):
|
|
|
|
| 84 |
story.append(f"The player interacted with {entry[2]}.")
|
| 85 |
return " ".join(story)
|
| 86 |
|
| 87 |
+
def generate_story_and_timeline(no_ui_timeline_points=10, no_media_timeline_points=5, include_media=True):
|
| 88 |
# Pick 10 random UI items
|
| 89 |
+
random_ui_items = pick_random_items(player_engagement_items, no_ui_timeline_points)
|
| 90 |
|
| 91 |
# Generate UI and story timelines
|
| 92 |
ui_timeline = generate_timeline(random_ui_items, "UI")
|
|
|
|
| 100 |
|
| 101 |
# Include media-related items if specified
|
| 102 |
if include_media:
|
| 103 |
+
media_files = generate_media_file_list(no_media_timeline_points)
|
| 104 |
#rendered_media = render_media_with_dropdowns(media_files)
|
| 105 |
media_timeline = generate_timeline(media_files, "Media")
|
| 106 |
merged_timeline += media_timeline
|
|
|
|
| 262 |
continue
|
| 263 |
|
| 264 |
with gr.Accordion(f"Location: {location}"):
|
| 265 |
+
description = gr.Textbox(label="Description", value=details['description'], interactive=True)
|
| 266 |
outputs.append(description)
|
| 267 |
|
| 268 |
+
events = gr.Textbox(label="Events", value=json.dumps(details['events']), interactive=True)
|
| 269 |
outputs.append(events)
|
| 270 |
|
| 271 |
+
choices = gr.Textbox(label="Choices", value=json.dumps(details['choices']), interactive=True)
|
| 272 |
outputs.append(choices)
|
| 273 |
|
| 274 |
+
transitions = gr.Textbox(label="Transitions", value=json.dumps(details['transitions']), interactive=True)
|
| 275 |
outputs.append(transitions)
|
| 276 |
|
| 277 |
def update_json():
|
|
|
|
| 608 |
<div style="width: 20%; text-align: center">HF + Gradio allows for api use so this my prototype tool for tool use test</div>
|
| 609 |
</div>""")
|
| 610 |
with gr.Tab("Skeleton Generator"):
|
| 611 |
+
with gr.Tab("Schema First"):
|
| 612 |
+
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
|
| 613 |
+
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")
|
| 614 |
+
with gr.Accordion("Proto Config Assist"):
|
| 615 |
+
gr.Markdown("Editing placeholder")
|
| 616 |
+
with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
|
| 617 |
+
gr.Markdown("# Story and Timeline Generator")
|
| 618 |
+
gr.Markdown("Click the button to generate a random timeline and story based on UI elements and story events. <br>Ask an LLM to use this to write a story around")
|
| 619 |
+
with gr.Accordion("JSON with no edits"):
|
| 620 |
+
with gr.Row():
|
| 621 |
+
timeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
|
| 622 |
+
timeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
|
| 623 |
+
story_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
|
| 624 |
+
with gr.Row():
|
| 625 |
+
game_structure_output_text_with_media = gr.Code(language="json")
|
| 626 |
+
game_structure_output_text = gr.Code(language="json")
|
| 627 |
+
|
| 628 |
+
with gr.Row():
|
| 629 |
+
generate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
|
| 630 |
+
generate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
|
| 631 |
+
generate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
|
| 632 |
+
generate_button = gr.Button("Generate Story and Timeline")
|
| 633 |
+
@gr.render(inputs=game_structure_output_text_with_media)
|
| 634 |
+
def update(game_structure_output_text_with_media):
|
| 635 |
+
return show_elements_json_input(game_structure_output_text_with_media)
|
| 636 |
+
|
| 637 |
+
generate_button.click(generate_story_and_timeline, inputs=[generate_no_ui_timeline_points, generate_no_media_timeline_points, generate_with_media_check], outputs=[timeline_output_with_assets, timeline_output, story_output, game_structure_output_text_with_media, game_structure_output_text])
|
| 638 |
+
|
| 639 |
+
gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
|
| 640 |
+
input_text = gr.Textbox(label="Input Text", lines=10)
|
| 641 |
+
output_group = gr.Group()
|
| 642 |
|
| 643 |
+
@gr.render(inputs=input_text)
|
| 644 |
+
def update(text):
|
| 645 |
+
return show_elements(text)
|
| 646 |
+
with gr.Tab("Asset First"):
|
| 647 |
+
gr.HTML("Make Asset and make the transitions using LLM")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
|
| 649 |
with gr.Tab("Test Example State Machine"):
|
| 650 |
with gr.Tab("Config Without Assets"):
|