kwabs22 commited on
Commit
b78075f
·
1 Parent(s): 29857f3

before some asset uploads

Browse files
Files changed (1) hide show
  1. app.py +22 -28
app.py CHANGED
@@ -118,10 +118,6 @@ media_file_types = ["image", "video", "audio"]
118
  def generate_media_file_list(n):
119
  return [random.choice(media_file_types) for _ in range(n)]
120
 
121
- # Example usage
122
- media_files = generate_media_file_list(10)
123
- #print(media_files)
124
-
125
  def render_media_with_dropdowns(media_files):
126
  rendered_output = []
127
  for index, media in enumerate(media_files):
@@ -136,22 +132,12 @@ def render_media_with_dropdowns(media_files):
136
  rendered_output.append(f"{iframe}{dropdown}")
137
  return rendered_output
138
 
139
- # Example usage
140
- rendered_media = render_media_with_dropdowns(media_files)
141
- #for item in rendered_media:
142
- # print(item)
143
-
144
  def save_to_placeholder(rendered_media):
145
  placeholder = []
146
  for item in rendered_media:
147
  placeholder.append(item)
148
  return placeholder
149
 
150
- # Example usage
151
- placeholder = save_to_placeholder(rendered_media)
152
- #for item in placeholder:
153
- # print(item)
154
-
155
  # Example usage with and without media-related items
156
  timeline_with_media, story_with_media = generate_story_and_timeline(include_media=True)
157
  timeline_without_media, story_without_media = generate_story_and_timeline(include_media=False)
@@ -519,22 +505,13 @@ with gr.Blocks() as demo:
519
  gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
520
  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")
521
  with gr.Tab("Generate Timeline"):
522
- with gr.Tab("Without Asset generation consideration"):
523
- gr.Markdown("# Story and Timeline Generator")
524
- gr.Markdown("Click the button to generate a random timeline and story based on UI elements and story events.")
525
-
526
- with gr.Row():
527
- timeline_output = gr.Textbox(label="Timeline", lines=20)
528
- story_output = gr.Textbox(label="Generated Story", lines=20)
529
-
530
- generate_button = gr.Button("Generate Story and Timeline")
531
- generate_button.click(generate_story_and_timeline, inputs=[], outputs=[timeline_output, story_output])
532
  with gr.Tab("Asset generation considered"):
533
- gr.HTML("placeholder")
534
 
535
  with gr.Tab("Prototype for finegrained editing of time line before conversion to game format"):
536
- gr.Textbox(value=timeline_with_media)
537
- gr.Textbox(value=timeline_without_media)
 
538
  gr.HTML("Splits by new line")
539
  input_text = gr.Textbox(label="Input Text", lines=10)
540
  output_group = gr.Group()
@@ -543,6 +520,7 @@ with gr.Blocks() as demo:
543
  def update(text):
544
  return show_elements(text)
545
  with gr.Tab("Conversion of game version"):
 
546
  media_checkbox = gr.Checkbox(label="Include Media")
547
  output_text = gr.Code(language="json")
548
 
@@ -551,12 +529,23 @@ with gr.Blocks() as demo:
551
  inputs=[media_checkbox],
552
  outputs=[output_text]
553
  )
 
 
 
 
 
 
 
 
 
 
554
  with gr.Tab("Test Example State Machine"):
555
  with gr.Row():
556
  with gr.Column(scale=2):
557
  gr.Markdown("# Text-based Adventure Game")
558
 
559
  description = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
 
560
  choices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
561
  submit_btn = gr.Button("Make Choice")
562
  game_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
@@ -654,7 +643,7 @@ with gr.Blocks() as demo:
654
 
655
 
656
  with gr.Tab("Asset Generation"):
657
- gr.HTML("With some ideas from gemini-1.5-flash-api-0514 and reka-flash-preview-20240611")
658
 
659
  with gr.Tab("Save files"):
660
  gr.HTML("For Dynamic events overnight or when player is not active what can LLMS edit? <br><br>eg. Waiting for a letter from a random npc can be decided by the llm <br>eg. Improved Stats on certain days (eg. bitrthday) <br>Privacy <br>User Directed DLC eg. Rockstar Editor with local llm guide")
@@ -720,5 +709,10 @@ with gr.Blocks() as demo:
720
  gr.HTML("GPU (Data privacy) = No Rate limits? - https://lambdalabs.com/service/gpu-cloud https://huggingface.co/pricing#endpoints")
721
  gr.HTML("Speed - Groq, SambaNova, ")
722
  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?")
 
 
 
 
 
723
 
724
  demo.launch()
 
118
  def generate_media_file_list(n):
119
  return [random.choice(media_file_types) for _ in range(n)]
120
 
 
 
 
 
121
  def render_media_with_dropdowns(media_files):
122
  rendered_output = []
123
  for index, media in enumerate(media_files):
 
132
  rendered_output.append(f"{iframe}{dropdown}")
133
  return rendered_output
134
 
 
 
 
 
 
135
  def save_to_placeholder(rendered_media):
136
  placeholder = []
137
  for item in rendered_media:
138
  placeholder.append(item)
139
  return placeholder
140
 
 
 
 
 
 
141
  # Example usage with and without media-related items
142
  timeline_with_media, story_with_media = generate_story_and_timeline(include_media=True)
143
  timeline_without_media, story_without_media = generate_story_and_timeline(include_media=False)
 
505
  gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
506
  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")
507
  with gr.Tab("Generate Timeline"):
 
 
 
 
 
 
 
 
 
 
508
  with gr.Tab("Asset generation considered"):
509
+ gr.HTML("Iframes are a placeholder for sample assets")
510
 
511
  with gr.Tab("Prototype for finegrained editing of time line before conversion to game format"):
512
+ with gr.Row():
513
+ gr.Textbox(value=timeline_with_media, lines=4)
514
+ gr.Textbox(value=timeline_without_media, lines=4)
515
  gr.HTML("Splits by new line")
516
  input_text = gr.Textbox(label="Input Text", lines=10)
517
  output_group = gr.Group()
 
520
  def update(text):
521
  return show_elements(text)
522
  with gr.Tab("Conversion of game version"):
523
+ gr.HTML("Can copy in the next tab - only linear path for now")
524
  media_checkbox = gr.Checkbox(label="Include Media")
525
  output_text = gr.Code(language="json")
526
 
 
529
  inputs=[media_checkbox],
530
  outputs=[output_text]
531
  )
532
+ with gr.Tab("Without Asset generation consideration"):
533
+ gr.Markdown("# Story and Timeline Generator")
534
+ 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")
535
+
536
+ with gr.Row():
537
+ timeline_output = gr.Textbox(label="Timeline", lines=20)
538
+ story_output = gr.Textbox(label="Generated Story", lines=20)
539
+
540
+ generate_button = gr.Button("Generate Story and Timeline")
541
+ generate_button.click(generate_story_and_timeline, inputs=[], outputs=[timeline_output, story_output])
542
  with gr.Tab("Test Example State Machine"):
543
  with gr.Row():
544
  with gr.Column(scale=2):
545
  gr.Markdown("# Text-based Adventure Game")
546
 
547
  description = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
548
+ media = gr.HTML("Placeholder to load all media tests")
549
  choices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
550
  submit_btn = gr.Button("Make Choice")
551
  game_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
 
643
 
644
 
645
  with gr.Tab("Asset Generation"):
646
+ gr.HTML("With some ideas from gemini-1.5-flash-api-0514 and reka-flash-preview-20240611 <br><br>Licenses for the spaces still to be evaluated")
647
 
648
  with gr.Tab("Save files"):
649
  gr.HTML("For Dynamic events overnight or when player is not active what can LLMS edit? <br><br>eg. Waiting for a letter from a random npc can be decided by the llm <br>eg. Improved Stats on certain days (eg. bitrthday) <br>Privacy <br>User Directed DLC eg. Rockstar Editor with local llm guide")
 
709
  gr.HTML("GPU (Data privacy) = No Rate limits? - https://lambdalabs.com/service/gpu-cloud https://huggingface.co/pricing#endpoints")
710
  gr.HTML("Speed - Groq, SambaNova, ")
711
  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?")
712
+ with gr.Tab("Asset loading test"):
713
+ gr.Image()
714
+ gr.Video()
715
+ gr.Audio()
716
+ gr.HTML()
717
 
718
  demo.launch()