Spaces:
Sleeping
Sleeping
kwabs22
commited on
Commit
·
a075dd7
1
Parent(s):
f61b6ea
Minor changes
Browse files
app.py
CHANGED
@@ -94,7 +94,9 @@ def generate_story_and_timeline(include_media=True):
|
|
94 |
|
95 |
# Initialize merged timeline with UI and story timelines
|
96 |
merged_timeline = ui_timeline + story_timeline
|
97 |
-
no_media_merged_timeline =
|
|
|
|
|
98 |
|
99 |
# Include media-related items if specified
|
100 |
if include_media:
|
@@ -103,6 +105,8 @@ def generate_story_and_timeline(include_media=True):
|
|
103 |
media_timeline = generate_timeline(media_files, "Media")
|
104 |
merged_timeline += media_timeline
|
105 |
|
|
|
|
|
106 |
# Sort the merged timeline based on the random numbers
|
107 |
merged_timeline.sort(key=lambda x: x[0])
|
108 |
no_media_merged_timeline.sort(key=lambda x: x[0])
|
@@ -116,11 +120,6 @@ def generate_story_and_timeline(include_media=True):
|
|
116 |
|
117 |
game_structure_with_media, game_structure_without_media = generate_game_structures(formatted_timeline, no_media_formatted_timeline)
|
118 |
|
119 |
-
# if include_media:
|
120 |
-
# return json.dumps(game_structure_with_media, indent=2)
|
121 |
-
# else:
|
122 |
-
# return json.dumps(game_structure_without_media, indent=2)
|
123 |
-
|
124 |
return formatted_timeline, no_media_formatted_timeline, story, json.dumps(game_structure_with_media, indent=2), json.dumps(game_structure_without_media, indent=2) #, game_structure_with_media
|
125 |
|
126 |
media_file_types = ["image", "video", "audio"]
|
@@ -128,9 +127,6 @@ media_file_types = ["image", "video", "audio"]
|
|
128 |
def generate_media_file_list(n):
|
129 |
return [random.choice(media_file_types) for _ in range(n)]
|
130 |
|
131 |
-
# Example usage with and without media-related items
|
132 |
-
# timeline_with_media, story_with_media = generate_story_and_timeline(include_media=True)
|
133 |
-
# timeline_without_media, story_without_media = generate_story_and_timeline(include_media=False)
|
134 |
|
135 |
def show_elements(text):
|
136 |
# Parse the input text
|
@@ -236,23 +232,12 @@ def convert_timeline_to_game_structure(timeline):
|
|
236 |
return wrapped_structure
|
237 |
|
238 |
def generate_game_structures(timeline_with_media, timeline_without_media):
|
239 |
-
# timeline_with_media, _ = generate_story_and_timeline(include_media=True)
|
240 |
-
# timeline_without_media, _ = generate_story_and_timeline(include_media=False)
|
241 |
|
242 |
game_structure_with_media = convert_timeline_to_game_structure(timeline_with_media)
|
243 |
game_structure_without_media = convert_timeline_to_game_structure(timeline_without_media)
|
244 |
|
245 |
return game_structure_with_media, game_structure_without_media
|
246 |
|
247 |
-
# Generate and print the game structures
|
248 |
-
# game_structure_with_media, game_structure_without_media = generate_game_structures()
|
249 |
-
|
250 |
-
def show_game_structure(include_media, game_structure_with_media, game_structure_without_media):
|
251 |
-
if include_media:
|
252 |
-
return json.dumps(game_structure_with_media, indent=2)
|
253 |
-
else:
|
254 |
-
return json.dumps(game_structure_without_media, indent=2)
|
255 |
-
|
256 |
|
257 |
#-----------------------------------------------------------------------------------------------------------------------------------
|
258 |
|
@@ -480,44 +465,30 @@ initgameinfo = start_game()
|
|
480 |
with gr.Blocks() as demo:
|
481 |
gr.HTML("""Main ideas for this space is (June 2024):
|
482 |
<div style="display: flex; justify-content: center; margin-bottom: 20px; align-items: center;">
|
483 |
-
<div style="width: 20%;">A program exist around data </div>
|
484 |
-
<div style="width: 20%;">We can generate almost any media data and more </div>
|
485 |
-
<div style="width: 20%;">llms good at short questions </div>
|
486 |
-
<div style="width: 20%;">Time moves in a straight so all considerations are flattend by the nature of time </div>
|
487 |
-
<div style="width: 20%;">HF + Gradio allows for api use so this my prototype tool for tool use test</div>
|
488 |
</div>""")
|
489 |
with gr.Tab("Skeleton Generator"):
|
490 |
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
|
491 |
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")
|
492 |
-
with gr.Accordion("
|
493 |
gr.Markdown("# Story and Timeline Generator")
|
494 |
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")
|
|
|
|
|
|
|
|
|
495 |
with gr.Row():
|
496 |
timeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
|
497 |
timeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
|
498 |
story_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
|
499 |
-
gr.Textbox("Do all fit on same row")
|
500 |
|
501 |
generate_button = gr.Button("Generate Story and Timeline")
|
502 |
-
|
503 |
-
media_checkbox = gr.Checkbox(label="Include Media", value=True)
|
504 |
-
with gr.Row():
|
505 |
-
game_structure_output_text_with_media = gr.Code(language="json")
|
506 |
-
game_structure_output_text = gr.Code(language="json")
|
507 |
-
# screen_game_structure_with_media = gr.State()
|
508 |
-
# screen_game_structure_without_media = gr.State()
|
509 |
-
|
510 |
-
# media_checkbox.change(
|
511 |
-
# fn=show_game_structure,
|
512 |
-
# inputs=[media_checkbox, screen_game_structure_with_media, screen_game_structure_without_media],
|
513 |
-
# outputs=[game_structure_output_text]
|
514 |
-
# )
|
515 |
-
|
516 |
-
|
517 |
-
generate_button.click(generate_story_and_timeline, inputs=[], outputs=[timeline_output_with_assets, timeline_output, story_output, game_structure_output_text_with_media, game_structure_output_text]) #screen_game_structure_with_media, screen_game_structure_without_media, game_structure_output_text])
|
518 |
-
# with gr.Row():
|
519 |
-
# gr.Textbox(value=timeline_with_media, lines=4)
|
520 |
-
# gr.Textbox(value=timeline_without_media, lines=4)
|
521 |
|
522 |
gr.HTML("Splits by new line")
|
523 |
input_text = gr.Textbox(label="Input Text", lines=10)
|
@@ -675,7 +646,8 @@ with gr.Blocks() as demo:
|
|
675 |
gr.HTML("Images Generation Posters with text - https://huggingface.co/spaces/GlyphByT5/Glyph-SDXL-v2")
|
676 |
gr.HTML("Images Generation Very Specific position and shape - https://huggingface.co/spaces/linoyts/scribble-sdxl-flash")
|
677 |
gr.HTML("SVG Generation = Coding models - ")
|
678 |
-
gr.HTML("
|
|
|
679 |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
|
680 |
|
681 |
with gr.Tab("Audio"):
|
@@ -708,7 +680,7 @@ with gr.Blocks() as demo:
|
|
708 |
gr.HTML("Any output that is not understood by the common person can be used as special effects eg. depth map filters on images etc.")
|
709 |
gr.HTML("Post-processing Effects, material effects, Particle systems, visual feedback")
|
710 |
gr.HTML("Visual Effects - eg. explosion can turn all items white for a moment, losing conciousness blurs whole screen")
|
711 |
-
gr.HTML("Placeholder for huggingface spaces that can assist - https://huggingface.co/spaces/EPFL-VILAB/4M ")
|
712 |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
|
713 |
|
714 |
with gr.Tab("Other Considerations"):
|
@@ -718,13 +690,15 @@ with gr.Blocks() as demo:
|
|
718 |
|
719 |
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")
|
720 |
|
|
|
|
|
721 |
gr.HTML("https://huggingface.co/spaces/linoyts/scribble-sdxl-flash as map planner")
|
722 |
|
723 |
gr.HTML("---------------------------------------Gameplay Ideas-------------------------------")
|
724 |
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")
|
725 |
with gr.Tab("Backend and/or Hosting?"):
|
726 |
gr.HTML("Prototyping and freemium <br>free api <br>HF Pro subscription")
|
727 |
-
gr.HTML("GPU (Data privacy) = No Rate limits? - https://lambdalabs.com/service/gpu-cloud https://huggingface.co/pricing#endpoints")
|
728 |
gr.HTML("Speed - Groq, SambaNova, ")
|
729 |
gr.HTML("Price - Coding - https://aider.chat/docs/leaderboards/ - https://www.deepseek.com/ 0.3 per million - is this per token or chinese character as that means converting code to chinese if possible can save api cost?")
|
730 |
with gr.Tab("Asset loading test"):
|
|
|
94 |
|
95 |
# Initialize merged timeline with UI and story timelines
|
96 |
merged_timeline = ui_timeline + story_timeline
|
97 |
+
no_media_merged_timeline = ui_timeline + story_timeline
|
98 |
+
print(merged_timeline)
|
99 |
+
print(no_media_formatted_timeline)
|
100 |
|
101 |
# Include media-related items if specified
|
102 |
if include_media:
|
|
|
105 |
media_timeline = generate_timeline(media_files, "Media")
|
106 |
merged_timeline += media_timeline
|
107 |
|
108 |
+
print(merged_timeline)
|
109 |
+
|
110 |
# Sort the merged timeline based on the random numbers
|
111 |
merged_timeline.sort(key=lambda x: x[0])
|
112 |
no_media_merged_timeline.sort(key=lambda x: x[0])
|
|
|
120 |
|
121 |
game_structure_with_media, game_structure_without_media = generate_game_structures(formatted_timeline, no_media_formatted_timeline)
|
122 |
|
|
|
|
|
|
|
|
|
|
|
123 |
return formatted_timeline, no_media_formatted_timeline, story, json.dumps(game_structure_with_media, indent=2), json.dumps(game_structure_without_media, indent=2) #, game_structure_with_media
|
124 |
|
125 |
media_file_types = ["image", "video", "audio"]
|
|
|
127 |
def generate_media_file_list(n):
|
128 |
return [random.choice(media_file_types) for _ in range(n)]
|
129 |
|
|
|
|
|
|
|
130 |
|
131 |
def show_elements(text):
|
132 |
# Parse the input text
|
|
|
232 |
return wrapped_structure
|
233 |
|
234 |
def generate_game_structures(timeline_with_media, timeline_without_media):
|
|
|
|
|
235 |
|
236 |
game_structure_with_media = convert_timeline_to_game_structure(timeline_with_media)
|
237 |
game_structure_without_media = convert_timeline_to_game_structure(timeline_without_media)
|
238 |
|
239 |
return game_structure_with_media, game_structure_without_media
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
#-----------------------------------------------------------------------------------------------------------------------------------
|
243 |
|
|
|
465 |
with gr.Blocks() as demo:
|
466 |
gr.HTML("""Main ideas for this space is (June 2024):
|
467 |
<div style="display: flex; justify-content: center; margin-bottom: 20px; align-items: center;">
|
468 |
+
<div style="width: 20%; text-align: center">A program exist around data </div>
|
469 |
+
<div style="width: 20%; text-align: center">We can generate almost any media data and more </div>
|
470 |
+
<div style="width: 20%; text-align: center">llms good at short questions </div>
|
471 |
+
<div style="width: 20%; text-align: center">Time moves in a straight so all considerations are flattend by the nature of time </div>
|
472 |
+
<div style="width: 20%; text-align: center">HF + Gradio allows for api use so this my prototype tool for tool use test</div>
|
473 |
</div>""")
|
474 |
with gr.Tab("Skeleton Generator"):
|
475 |
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
|
476 |
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")
|
477 |
+
with gr.Accordion("Proto Config Assist"):
|
478 |
gr.Markdown("# Story and Timeline Generator")
|
479 |
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")
|
480 |
+
with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
|
481 |
+
with gr.Row():
|
482 |
+
game_structure_output_text_with_media = gr.Code(language="json")
|
483 |
+
game_structure_output_text = gr.Code(language="json")
|
484 |
with gr.Row():
|
485 |
timeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
|
486 |
timeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
|
487 |
story_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
|
488 |
+
#gr.Textbox("Do all fit on same row")
|
489 |
|
490 |
generate_button = gr.Button("Generate Story and Timeline")
|
491 |
+
generate_button.click(generate_story_and_timeline, inputs=[], outputs=[timeline_output_with_assets, timeline_output, story_output, game_structure_output_text_with_media, game_structure_output_text])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
|
493 |
gr.HTML("Splits by new line")
|
494 |
input_text = gr.Textbox(label="Input Text", lines=10)
|
|
|
646 |
gr.HTML("Images Generation Posters with text - https://huggingface.co/spaces/GlyphByT5/Glyph-SDXL-v2")
|
647 |
gr.HTML("Images Generation Very Specific position and shape - https://huggingface.co/spaces/linoyts/scribble-sdxl-flash")
|
648 |
gr.HTML("SVG Generation = Coding models - ")
|
649 |
+
gr.HTML("Vision Models for descriptions <br> https://huggingface.co/spaces/gokaygokay/Florence-2 <br>https://huggingface.co/spaces/vilarin/VL-Chatbox - glm 4v 9b <br>")
|
650 |
+
gr.HTML("Placeholder for huggingface spaces that can assist ")
|
651 |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
|
652 |
|
653 |
with gr.Tab("Audio"):
|
|
|
680 |
gr.HTML("Any output that is not understood by the common person can be used as special effects eg. depth map filters on images etc.")
|
681 |
gr.HTML("Post-processing Effects, material effects, Particle systems, visual feedback")
|
682 |
gr.HTML("Visual Effects - eg. explosion can turn all items white for a moment, losing conciousness blurs whole screen")
|
683 |
+
gr.HTML("Placeholder for huggingface spaces that can assist - https://huggingface.co/spaces/EPFL-VILAB/4M, https://huggingface.co/spaces/EPFL-VILAB/MultiMAE ")
|
684 |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
|
685 |
|
686 |
with gr.Tab("Other Considerations"):
|
|
|
690 |
|
691 |
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")
|
692 |
|
693 |
+
gr.HTML("langchain docs as awareness for alot of the integration use cases and providers that are possible - https://python.langchain.com/v0.2/docs/integrations/tools/")
|
694 |
+
|
695 |
gr.HTML("https://huggingface.co/spaces/linoyts/scribble-sdxl-flash as map planner")
|
696 |
|
697 |
gr.HTML("---------------------------------------Gameplay Ideas-------------------------------")
|
698 |
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")
|
699 |
with gr.Tab("Backend and/or Hosting?"):
|
700 |
gr.HTML("Prototyping and freemium <br>free api <br>HF Pro subscription")
|
701 |
+
gr.HTML("GPU (Data privacy) = No Rate limits? - https://lambdalabs.com/service/gpu-cloud https://huggingface.co/pricing#endpoints https://tensordock.com/cloud-gpus")
|
702 |
gr.HTML("Speed - Groq, SambaNova, ")
|
703 |
gr.HTML("Price - Coding - https://aider.chat/docs/leaderboards/ - https://www.deepseek.com/ 0.3 per million - is this per token or chinese character as that means converting code to chinese if possible can save api cost?")
|
704 |
with gr.Tab("Asset loading test"):
|