Spaces:
Running
on
Zero
Running
on
Zero
kwabs22
commited on
Commit
·
cb022bb
1
Parent(s):
91c4bdb
File uploads and placholders
Browse files
app.py
CHANGED
@@ -3,6 +3,8 @@ import random
|
|
3 |
import json
|
4 |
import re
|
5 |
import os
|
|
|
|
|
6 |
|
7 |
# Default configuration template
|
8 |
default_config = {
|
@@ -160,49 +162,6 @@ def show_elements(text):
|
|
160 |
|
161 |
return outputs
|
162 |
|
163 |
-
# def show_elements_json_input(json_input):
|
164 |
-
# data = json.loads(json_input)
|
165 |
-
# masterlocation1 = data['masterlocation1']
|
166 |
-
|
167 |
-
# outputs = []
|
168 |
-
|
169 |
-
# for location, details in masterlocation1.items():
|
170 |
-
# if location == 'end':
|
171 |
-
# continue
|
172 |
-
|
173 |
-
# with gr.Accordion(f"Location: {location} - Previous desciption {details['description']}", open=False):
|
174 |
-
# description = gr.Textbox(label="Description", value=details['description'], interactive=True)
|
175 |
-
# outputs.append(description)
|
176 |
-
|
177 |
-
# events = gr.Textbox(label="Events", value=json.dumps(details['events']), interactive=True)
|
178 |
-
# outputs.append(events)
|
179 |
-
|
180 |
-
# choices = gr.Textbox(label="Choices", value=json.dumps(details['choices']), interactive=True)
|
181 |
-
# outputs.append(choices)
|
182 |
-
|
183 |
-
# transitions = gr.Textbox(label="Transitions", value=json.dumps(details['transitions']), interactive=True)
|
184 |
-
# outputs.append(transitions)
|
185 |
-
|
186 |
-
# def update_json(*current_values):
|
187 |
-
# updated_data = {"masterlocation1": {}}
|
188 |
-
# locations = [loc for loc in masterlocation1.keys() if loc != 'end']
|
189 |
-
# for i, location in enumerate(locations):
|
190 |
-
# updated_data["masterlocation1"][location] = {
|
191 |
-
# "description": current_values[i*4],
|
192 |
-
# "events": json.loads(current_values[i*4 + 1]),
|
193 |
-
# "choices": json.loads(current_values[i*4 + 2]),
|
194 |
-
# "transitions": json.loads(current_values[i*4 + 3])
|
195 |
-
# }
|
196 |
-
# updated_data["masterlocation1"]["end"] = masterlocation1["end"]
|
197 |
-
# return json.dumps(updated_data, indent=2)
|
198 |
-
|
199 |
-
# update_button = gr.Button("Update JSON")
|
200 |
-
# json_output = gr.Textbox(label="Updated JSON", lines=10)
|
201 |
-
|
202 |
-
# update_button.click(update_json, inputs=outputs, outputs=json_output)
|
203 |
-
|
204 |
-
# return outputs + [update_button, json_output]
|
205 |
-
|
206 |
def show_elements_json_input(json_input):
|
207 |
data = json.loads(json_input)
|
208 |
masterlocation1 = data['masterlocation1']
|
@@ -528,69 +487,6 @@ def make_choice(choice, game_session, with_media=False): #Calls the nested make
|
|
528 |
else:
|
529 |
return result[0], gr.update(choices=result[1]), result[2], game_session
|
530 |
|
531 |
-
# def load_game(custom_config=None, with_media=False):
|
532 |
-
# global all_states
|
533 |
-
# if custom_config:
|
534 |
-
# try:
|
535 |
-
# new_config = json.loads(custom_config)
|
536 |
-
|
537 |
-
# all_states = new_config
|
538 |
-
|
539 |
-
# # Determine the starting location and state
|
540 |
-
# starting_location = next(iter(all_states.keys()))
|
541 |
-
# starting_state = next(iter(all_states[starting_location].keys()))
|
542 |
-
# print(starting_location, starting_state)
|
543 |
-
|
544 |
-
# game_session = GameSession(starting_location, starting_state)
|
545 |
-
# description, choices, game_log = game_session.get_current_state_info()
|
546 |
-
# new_path_errors = validate_transitions(all_states)
|
547 |
-
# media = None
|
548 |
-
# output_media = None
|
549 |
-
|
550 |
-
# print(all_states[starting_location][starting_state][media])
|
551 |
-
# print(with_media)
|
552 |
-
# print("everything fine till here")
|
553 |
-
# if with_media:
|
554 |
-
# print("everything fine till here 5")
|
555 |
-
# if all_states[starting_location][starting_state][media] != []:
|
556 |
-
# print(f"everything fine till here 4 - {all_states[starting_location][starting_state][media]}")
|
557 |
-
# media = all_states[starting_location][starting_state][media]
|
558 |
-
# print("everything fine till here 2")
|
559 |
-
# for media_path in media:
|
560 |
-
# media_component = create_media_component(media_path)
|
561 |
-
# output_media.append(media_component)
|
562 |
-
# print("everything fine till here 3")
|
563 |
-
# return gr.update(value=f"Custom configuration loaded successfully! \n{new_path_errors}"), game_log, description, gr.update(choices=choices), game_session, gr.update(value=custom_config), output_media
|
564 |
-
|
565 |
-
# return gr.update(value=f"Custom configuration loaded successfully! \n{new_path_errors}"), game_log, description, gr.update(choices=choices), game_session, gr.update(value=custom_config)
|
566 |
-
# except json.JSONDecodeError as e:
|
567 |
-
# # Get the line number and column of the error
|
568 |
-
# lineno, colno = e.lineno, e.colno
|
569 |
-
|
570 |
-
# # Get the problematic line
|
571 |
-
# lines = custom_config.split('\n')
|
572 |
-
# error_line = lines[lineno - 1] if lineno <= len(lines) else ""
|
573 |
-
|
574 |
-
# # Create a pointer to the error location
|
575 |
-
# pointer = ' ' * (colno - 1) + '^'
|
576 |
-
|
577 |
-
# error_message = f"Invalid JSON format in custom configuration:\n"
|
578 |
-
# error_message += f"Error at line {lineno}, column {colno}:\n"
|
579 |
-
# error_message += f"{error_line}\n"
|
580 |
-
# error_message += f"{pointer}\n"
|
581 |
-
# error_message += f"Error details: {str(e)}"
|
582 |
-
|
583 |
-
# return gr.update(value=error_message), gr.update(), gr.update(), None, gr.update(value=custom_config), game_session, gr.update(value=custom_config)
|
584 |
-
# except Exception as e:
|
585 |
-
# return gr.update(value=f"Error loading custom configuration: {str(e)}"), gr.update(), gr.update(), None, gr.update(value=custom_config), game_session, gr.update(value=custom_config)
|
586 |
-
|
587 |
-
# # If no custom config, start with the default configuration
|
588 |
-
# starting_location = next(iter(all_states.keys()))
|
589 |
-
# starting_state = next(iter(all_states[starting_location].keys()))
|
590 |
-
# game_session = GameSession(starting_location, starting_state)
|
591 |
-
# description, choices, game_log = game_session.get_current_state_info()
|
592 |
-
# return description, gr.update(choices=choices), game_log, game_session, gr.update()
|
593 |
-
|
594 |
def load_game(custom_config=None, with_media=False):
|
595 |
global all_states
|
596 |
if not custom_config:
|
@@ -662,6 +558,74 @@ initgameinfo = start_game()
|
|
662 |
|
663 |
#-----------------------------------------------------------------------------------------------------------------------------------
|
664 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
with gr.Blocks() as demo:
|
666 |
gr.HTML("""<div style="width: 100%; text-align: center">Main ideas for this space is (June 2024) (Custom component planning?):</div>
|
667 |
<div style="display: flex; justify-content: center; margin-bottom: 20px; align-items: center;">
|
@@ -672,31 +636,82 @@ with gr.Blocks() as demo:
|
|
672 |
<div style="width: 20%; text-align: center">HF + Gradio allows for api use so this my prototype tool for tool use test</div>
|
673 |
</div>""")
|
674 |
with gr.Tab("Skeleton Generator"):
|
|
|
|
|
|
|
675 |
with gr.Row():
|
676 |
-
with gr.Column(scale=
|
677 |
with gr.Tab("Asset path Assist"):
|
678 |
gr.HTML("Make Files and Text ideas for the field and paste")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
679 |
with gr.Accordion("Text"):
|
680 |
gr.HTML("Embed of a text sites")
|
681 |
-
with gr.Accordion("LLM HF Spaces/Sites (Click Here to Open) -
|
682 |
with gr.Row():
|
683 |
linktochat = gr.Dropdown(choices=["https://labs.perplexity.ai/", "https://chat.lmsys.org", "https://sdk.vercel.ai/docs", "https://qwen-qwen-max-0428.hf.space", "https://cohereforai-c4ai-command-r-plus.hf.space", "https://huggingface.co/spaces/eswardivi/Phi-3-mini-128k-instruct", "https://eswardivi-phi-3-mini-4k-instruct.hf.space", "https://cyzgab-catch-me-if-you-can.hf.space", "https://snowflake-snowflake-arctic-st-demo.hf.space", "https://qwen-qwen1-5-110b-chat-demo.hf.space", "https://ysharma-chat-with-meta-llama3-8b.hf.space", "https://databricks-dbrx-instruct.hf.space", "https://qwen-qwen1-5-moe-a2-7b-chat-demo.hf.space", "https://cohereforai-c4ai-command-r-v01.hf.space", "https://ehristoforu-mixtral-46-7b-chat.hf.space", "https://stabilityai-stablelm-2-1-6b-zephyr.hf.space", "https://qwen-qwen1-5-72b-chat.hf.space", "https://deepseek-ai-deepseek-coder-7b-instruct.hf.space", "https://01-ai-yi-34b-chat.hf.space", "https://ysharma-zephyr-playground.hf.space", "https://huggingfaceh4-zephyr-chat.hf.space", "https://osanseviero-mistral-super-fast.hf.space", "https://artificialguybr-qwen-14b-chat-demo.hf.space", "https://huggingface-projects-llama-2-7b-chat.hf.space", "https://ysharma-explore-llamav2-with-tgi.hf.space", "https://mosaicml-mpt-30b-chat.hf.space", "https://huggingfaceh4-falcon-chat.hf.space", "https://uwnlp-guanaco-playground-tgi.hf.space", "https://stabilityai-stablelm-tuned-alpha-chat.hf.space", "https://mosaicml-mpt-7b-storywriter.hf.space", "https://huggingfaceh4-starchat-playground.hf.space", "https://bigcode-bigcode-playground.hf.space", "https://mosaicml-mpt-7b-chat.hf.space", "https://huggingchat-chat-ui.hf.space", "https://togethercomputer-openchatkit.hf.space"], label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True)
|
684 |
chatspacebtn = gr.Button("Use the chosen URL to load interface with a chat model. For sdk.vercel click the chat button on the top left. For lymsys / chat arena copy the link and use a new tab")
|
685 |
chatspace = gr.HTML("Chat Space Chosen will load here")
|
686 |
chatspacebtn.click(display_website, inputs=linktochat, outputs=chatspace)
|
687 |
with gr.Accordion("Other"):
|
688 |
-
with gr.Accordion("Image Gen or Animation HF Spaces/Sites (Click Here to Open) -
|
689 |
with gr.Row():
|
690 |
-
linktoimagegen = gr.Dropdown(choices=["https://huggingface.co/spaces/linoyts/scribble-sdxl-flash" "https://prodia-sdxl-stable-diffusion-xl.hf.space", "https://prodia-fast-stable-diffusion.hf.space", "https://lllyasviel-ic-light.hf.space", "https://gparmar-img2img-turbo-sketch.hf.space", "https://artificialguybr-artificialguybr-demo-lora.hf.space", "https://kadirnar-open-sora.hf.space", "https://bytedance-animatediff-lightning.hf.space", "https://bytedance-hyper-sdxl-1step-t2i.hf.space", "https://ehristoforu-dalle-3-xl-lora-v2.hf.space", "https://multimodalart-cosxl.hf.space", "https://radames-real-time-text-to-image-sdxl-lightning.hf.space", "https://cagliostrolab-animagine-xl-3-1.hf.space", "https://wangfuyun-animatelcm-svd.hf.space" "https://modelscope-transferanything.hf.space", "https://visionmaze-magic-me.hf.space", "https://wangfuyun-animatelcm.hf.space", "https://artgan-diffusion-api.hf.space", "https://multimodalart-stable-cascade.hf.space", "https://ap123-sdxl-lightning.hf.space", "https://google-sdxl.hf.space", "https://guoyww-animatediff.hf.space", "https://segmind-segmind-stable-diffusion.hf.space", "https://simianluo-latent-consistency-model.hf.space", "https://artificialguybr-studio-ghibli-lora-sdxl.hf.space", "https://artificialguybr-pixel-art-generator.hf.space", "https://fffiloni-sdxl-control-loras.hf.space"], label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True)
|
691 |
imagegenspacebtn = gr.Button("Use the chosen URL to load interface with a chat model")
|
692 |
imagegenspace = gr.HTML("Chat Space Chosen will load here")
|
693 |
imagegenspacebtn.click(display_website, inputs=linktoimagegen, outputs=imagegenspace)
|
694 |
-
|
695 |
-
gr.FileExplorer(label="Find the correct paths for things added", value=["testmedia"])
|
696 |
-
with gr.Column(scale=2):
|
697 |
with gr.Tab("Schema First"):
|
698 |
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
|
699 |
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")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
700 |
with gr.Accordion("Proto Config Assist"):
|
701 |
gr.Markdown("Editing placeholder")
|
702 |
with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
|
@@ -723,17 +738,12 @@ with gr.Blocks() as demo:
|
|
723 |
|
724 |
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])
|
725 |
|
726 |
-
gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
|
727 |
-
input_text = gr.Textbox(label="Input Text", lines=10)
|
728 |
-
output_group = gr.Group()
|
729 |
-
|
730 |
-
@gr.render(inputs=input_text)
|
731 |
-
def update(text):
|
732 |
-
return show_elements(text)
|
733 |
-
|
734 |
with gr.Tab("Asset First"):
|
735 |
gr.HTML("Make Asset and make the transitions using LLM")
|
736 |
|
|
|
|
|
|
|
737 |
with gr.Tab("Test Example State Machine"):
|
738 |
with gr.Tab("Config Without Assets"):
|
739 |
with gr.Row():
|
@@ -806,8 +816,12 @@ with gr.Blocks() as demo:
|
|
806 |
inputs=[wacustom_config, wamediabool],
|
807 |
outputs=[waerror_box, wagame_log, wadescription, wachoices, wacustom_config, wagame_session, wamedia]
|
808 |
)
|
|
|
|
|
|
|
|
|
809 |
with gr.Tab("Custom JS Config Creator"):
|
810 |
-
gr.HTML("Companion Space for zerogpu / client api workflow planning for a way to send a zip to the Basic Game Engine at the bottom of https://huggingface.co/spaces/KwabsHug/TestSvelteStatic (Also to test how much can be done majority on cpu)")
|
811 |
with gr.Tab("Simple Config Creator"):
|
812 |
inventory_items = gr.State([])
|
813 |
skills_items = gr.State([])
|
@@ -935,6 +949,10 @@ with gr.Blocks() as demo:
|
|
935 |
gr.HTML("Visual Effects - eg. explosion can turn all items white for a moment, losing conciousness blurs whole screen")
|
936 |
gr.HTML("Placeholder for huggingface spaces that can assist - https://huggingface.co/spaces/EPFL-VILAB/4M, https://huggingface.co/spaces/EPFL-VILAB/MultiMAE ")
|
937 |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
|
|
|
|
|
|
|
|
|
938 |
|
939 |
with gr.Tab("Other Considerations"):
|
940 |
with gr.Tab("General"):
|
@@ -959,6 +977,7 @@ with gr.Blocks() as demo:
|
|
959 |
gr.HTML("Speed - Groq, SambaNova, https://www.etched.com/announcing-etched ")
|
960 |
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?")
|
961 |
with gr.Tab("Asset loading test"):
|
|
|
962 |
with gr.Row():
|
963 |
gr.Image(value="testmedia/Flash scribble SDXL - random squiggles as roads.webp")
|
964 |
gr.Video(value="testmedia/SVD - random squiggles as roads video 004484.mp4")
|
|
|
3 |
import json
|
4 |
import re
|
5 |
import os
|
6 |
+
import shutil
|
7 |
+
from PIL import Image
|
8 |
|
9 |
# Default configuration template
|
10 |
default_config = {
|
|
|
162 |
|
163 |
return outputs
|
164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
def show_elements_json_input(json_input):
|
166 |
data = json.loads(json_input)
|
167 |
masterlocation1 = data['masterlocation1']
|
|
|
487 |
else:
|
488 |
return result[0], gr.update(choices=result[1]), result[2], game_session
|
489 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
def load_game(custom_config=None, with_media=False):
|
491 |
global all_states
|
492 |
if not custom_config:
|
|
|
558 |
|
559 |
#-----------------------------------------------------------------------------------------------------------------------------------
|
560 |
|
561 |
+
# Set the directory where files will be saved
|
562 |
+
SAVE_DIR = os.path.abspath("saved_media")
|
563 |
+
|
564 |
+
# Ensure the save directory exists
|
565 |
+
os.makedirs(SAVE_DIR, exist_ok=True)
|
566 |
+
|
567 |
+
# Define supported file extensions
|
568 |
+
SUPPORTED_EXTENSIONS = {
|
569 |
+
"image": [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp"],
|
570 |
+
"audio": [".mp3", ".wav", ".ogg"],
|
571 |
+
"video": [".mp4", ".avi", ".mov", ".webm"]
|
572 |
+
}
|
573 |
+
|
574 |
+
def save_file(file):
|
575 |
+
if file is None:
|
576 |
+
return "No file uploaded.", gr.update()
|
577 |
+
|
578 |
+
try:
|
579 |
+
# Get the original filename and extension
|
580 |
+
original_filename = os.path.basename(file.name)
|
581 |
+
_, extension = os.path.splitext(original_filename)
|
582 |
+
|
583 |
+
# Check if the file extension is supported
|
584 |
+
if not any(extension.lower() in exts for exts in SUPPORTED_EXTENSIONS.values()):
|
585 |
+
return f"Unsupported file type: {extension}", gr.update()
|
586 |
+
|
587 |
+
# Create a unique filename to avoid overwriting
|
588 |
+
base_name = os.path.splitext(original_filename)[0]
|
589 |
+
counter = 1
|
590 |
+
new_filename = f"{base_name}{extension}"
|
591 |
+
while os.path.exists(os.path.join(SAVE_DIR, new_filename)):
|
592 |
+
new_filename = f"{base_name}_{counter}{extension}"
|
593 |
+
counter += 1
|
594 |
+
|
595 |
+
# Copy the file from the temporary location to our save directory
|
596 |
+
dest_path = os.path.join(SAVE_DIR, new_filename)
|
597 |
+
shutil.copy2(file.name, dest_path)
|
598 |
+
|
599 |
+
# Return success message and updated FileExplorer
|
600 |
+
return f"File saved as {new_filename} in {SAVE_DIR}", gr.update(value=SAVE_DIR), gr.update(value=None)
|
601 |
+
except Exception as e:
|
602 |
+
return f"Error saving file: {str(e)}", gr.update(value=SAVE_DIR), gr.update()
|
603 |
+
|
604 |
+
def view_file(file_path):
|
605 |
+
if not file_path:
|
606 |
+
return None, None, None, "No file selected."
|
607 |
+
|
608 |
+
try:
|
609 |
+
full_path = os.path.join(SAVE_DIR, file_path)
|
610 |
+
_, extension = os.path.splitext(full_path)
|
611 |
+
extension = extension.lower()
|
612 |
+
|
613 |
+
if extension in SUPPORTED_EXTENSIONS["image"]:
|
614 |
+
return Image.open(full_path), None, None, None
|
615 |
+
elif extension in SUPPORTED_EXTENSIONS["audio"]:
|
616 |
+
return None, full_path, None, None
|
617 |
+
elif extension in SUPPORTED_EXTENSIONS["video"]:
|
618 |
+
return None, None, full_path, None
|
619 |
+
else:
|
620 |
+
return None, None, None, f"Unsupported file type: {extension}"
|
621 |
+
except Exception as e:
|
622 |
+
return None, None, None, f"Error viewing file: {str(e)}"
|
623 |
+
|
624 |
+
def refresh_file_explorer():
|
625 |
+
return gr.update()
|
626 |
+
|
627 |
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
628 |
+
|
629 |
with gr.Blocks() as demo:
|
630 |
gr.HTML("""<div style="width: 100%; text-align: center">Main ideas for this space is (June 2024) (Custom component planning?):</div>
|
631 |
<div style="display: flex; justify-content: center; margin-bottom: 20px; align-items: center;">
|
|
|
636 |
<div style="width: 20%; text-align: center">HF + Gradio allows for api use so this my prototype tool for tool use test</div>
|
637 |
</div>""")
|
638 |
with gr.Tab("Skeleton Generator"):
|
639 |
+
gr.HTML("Song / Random Scenario to 'full game' manual or auto is end goal ")
|
640 |
+
gr.HTML("Main Priority is to make rails for the story to work on as a simplified view of a game is a linear path with loops (gameplay mechanics) <br> Below = Manual Edit (At bottom you can save the changes and copy it to test) <br>For LLM edit copy either the Timeline")
|
641 |
+
gr.HTML("The problem is the assets generation isnt free and using spaces as api also clogs them (no way to know when ZeroGPUs are at lowest usage) so using iFrame is better for now <br> So worklfow -- Make Skeleton -- Use Iframe to get media -- then ask for details / story / gameplay loop ideas and add back to config")
|
642 |
with gr.Row():
|
643 |
+
with gr.Column(scale=2):
|
644 |
with gr.Tab("Asset path Assist"):
|
645 |
gr.HTML("Make Files and Text ideas for the field and paste")
|
646 |
+
with gr.Accordion("Upload Files for config"):
|
647 |
+
gr.Markdown("# Media Saver and Explorer (refresh file list to be resolved)")
|
648 |
+
with gr.Tab("Upload Files"):
|
649 |
+
file_input = gr.File(label="Choose File to Upload")
|
650 |
+
save_output = gr.Textbox(label="Upload Status")
|
651 |
+
|
652 |
+
with gr.Tab("File Explorer"):
|
653 |
+
with gr.Row():
|
654 |
+
file_explorer = gr.FileExplorer(
|
655 |
+
root_dir=SAVE_DIR,
|
656 |
+
glob="*.*",
|
657 |
+
file_count="single",
|
658 |
+
height=300,
|
659 |
+
label="Select a file to view"
|
660 |
+
)
|
661 |
+
refresh_button = gr.Button("Refresh", scale=1)
|
662 |
+
|
663 |
+
view_button = gr.Button("View File")
|
664 |
+
image_output = gr.Image(label="Image Output", type="pil")
|
665 |
+
audio_output = gr.Audio(label="Audio Output")
|
666 |
+
video_output = gr.Video(label="Video Output")
|
667 |
+
error_output = gr.Textbox(label="Error")
|
668 |
+
|
669 |
+
file_input.upload(
|
670 |
+
save_file,
|
671 |
+
inputs=file_input,
|
672 |
+
outputs=[save_output, file_explorer, file_input]
|
673 |
+
)
|
674 |
+
|
675 |
+
view_button.click(
|
676 |
+
view_file,
|
677 |
+
inputs=file_explorer,
|
678 |
+
outputs=[image_output, audio_output, video_output, error_output]
|
679 |
+
)
|
680 |
+
|
681 |
+
refresh_button.click(
|
682 |
+
refresh_file_explorer,
|
683 |
+
outputs=file_explorer
|
684 |
+
)
|
685 |
+
gr.HTML("Placeholder for clearing uploaded assets (public space and temporary persistence = sharing and space problems)")
|
686 |
+
|
687 |
with gr.Accordion("Text"):
|
688 |
gr.HTML("Embed of a text sites")
|
689 |
+
with gr.Accordion("LLM HF Spaces/Sites (Click Here to Open) - Ask for a story and suggestions based on the autoconfig", open=False):
|
690 |
with gr.Row():
|
691 |
linktochat = gr.Dropdown(choices=["https://labs.perplexity.ai/", "https://chat.lmsys.org", "https://sdk.vercel.ai/docs", "https://qwen-qwen-max-0428.hf.space", "https://cohereforai-c4ai-command-r-plus.hf.space", "https://huggingface.co/spaces/eswardivi/Phi-3-mini-128k-instruct", "https://eswardivi-phi-3-mini-4k-instruct.hf.space", "https://cyzgab-catch-me-if-you-can.hf.space", "https://snowflake-snowflake-arctic-st-demo.hf.space", "https://qwen-qwen1-5-110b-chat-demo.hf.space", "https://ysharma-chat-with-meta-llama3-8b.hf.space", "https://databricks-dbrx-instruct.hf.space", "https://qwen-qwen1-5-moe-a2-7b-chat-demo.hf.space", "https://cohereforai-c4ai-command-r-v01.hf.space", "https://ehristoforu-mixtral-46-7b-chat.hf.space", "https://stabilityai-stablelm-2-1-6b-zephyr.hf.space", "https://qwen-qwen1-5-72b-chat.hf.space", "https://deepseek-ai-deepseek-coder-7b-instruct.hf.space", "https://01-ai-yi-34b-chat.hf.space", "https://ysharma-zephyr-playground.hf.space", "https://huggingfaceh4-zephyr-chat.hf.space", "https://osanseviero-mistral-super-fast.hf.space", "https://artificialguybr-qwen-14b-chat-demo.hf.space", "https://huggingface-projects-llama-2-7b-chat.hf.space", "https://ysharma-explore-llamav2-with-tgi.hf.space", "https://mosaicml-mpt-30b-chat.hf.space", "https://huggingfaceh4-falcon-chat.hf.space", "https://uwnlp-guanaco-playground-tgi.hf.space", "https://stabilityai-stablelm-tuned-alpha-chat.hf.space", "https://mosaicml-mpt-7b-storywriter.hf.space", "https://huggingfaceh4-starchat-playground.hf.space", "https://bigcode-bigcode-playground.hf.space", "https://mosaicml-mpt-7b-chat.hf.space", "https://huggingchat-chat-ui.hf.space", "https://togethercomputer-openchatkit.hf.space"], label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True)
|
692 |
chatspacebtn = gr.Button("Use the chosen URL to load interface with a chat model. For sdk.vercel click the chat button on the top left. For lymsys / chat arena copy the link and use a new tab")
|
693 |
chatspace = gr.HTML("Chat Space Chosen will load here")
|
694 |
chatspacebtn.click(display_website, inputs=linktochat, outputs=chatspace)
|
695 |
with gr.Accordion("Other"):
|
696 |
+
with gr.Accordion("Image Gen or Animation HF Spaces/Sites (Click Here to Open) - Have to download and upload at the the top", open=False):
|
697 |
with gr.Row():
|
698 |
+
linktoimagegen = gr.Dropdown(choices=["https://huggingface.co/spaces/linoyts/scribble-sdxl-flash", "https://prodia-sdxl-stable-diffusion-xl.hf.space", "https://prodia-fast-stable-diffusion.hf.space", "https://lllyasviel-ic-light.hf.space", "https://gparmar-img2img-turbo-sketch.hf.space", "https://artificialguybr-artificialguybr-demo-lora.hf.space", "https://kadirnar-open-sora.hf.space", "https://bytedance-animatediff-lightning.hf.space", "https://bytedance-hyper-sdxl-1step-t2i.hf.space", "https://ehristoforu-dalle-3-xl-lora-v2.hf.space", "https://multimodalart-cosxl.hf.space", "https://radames-real-time-text-to-image-sdxl-lightning.hf.space", "https://cagliostrolab-animagine-xl-3-1.hf.space", "https://wangfuyun-animatelcm-svd.hf.space" "https://modelscope-transferanything.hf.space", "https://visionmaze-magic-me.hf.space", "https://wangfuyun-animatelcm.hf.space", "https://artgan-diffusion-api.hf.space", "https://multimodalart-stable-cascade.hf.space", "https://ap123-sdxl-lightning.hf.space", "https://google-sdxl.hf.space", "https://guoyww-animatediff.hf.space", "https://segmind-segmind-stable-diffusion.hf.space", "https://simianluo-latent-consistency-model.hf.space", "https://artificialguybr-studio-ghibli-lora-sdxl.hf.space", "https://artificialguybr-pixel-art-generator.hf.space", "https://fffiloni-sdxl-control-loras.hf.space"], label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True)
|
699 |
imagegenspacebtn = gr.Button("Use the chosen URL to load interface with a chat model")
|
700 |
imagegenspace = gr.HTML("Chat Space Chosen will load here")
|
701 |
imagegenspacebtn.click(display_website, inputs=linktoimagegen, outputs=imagegenspace)
|
702 |
+
with gr.Column(scale=3):
|
|
|
|
|
703 |
with gr.Tab("Schema First"):
|
704 |
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
|
705 |
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")
|
706 |
+
with gr.Accoridion(""):
|
707 |
+
gr.Markdown("Asset Generation")
|
708 |
+
gr.HTML("Splits by new line - The idea here was to allow for saving the file ")
|
709 |
+
input_text = gr.Textbox(label="Input Text", lines=10)
|
710 |
+
output_group = gr.Group()
|
711 |
+
|
712 |
+
@gr.render(inputs=input_text)
|
713 |
+
def update(text):
|
714 |
+
return show_elements(text)
|
715 |
with gr.Accordion("Proto Config Assist"):
|
716 |
gr.Markdown("Editing placeholder")
|
717 |
with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
|
|
|
738 |
|
739 |
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])
|
740 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
741 |
with gr.Tab("Asset First"):
|
742 |
gr.HTML("Make Asset and make the transitions using LLM")
|
743 |
|
744 |
+
with gr.Tab("Export Options"):
|
745 |
+
gr.HTML("Placeholder - My Custom JS, Playcanvas, Unreal Engine")
|
746 |
+
|
747 |
with gr.Tab("Test Example State Machine"):
|
748 |
with gr.Tab("Config Without Assets"):
|
749 |
with gr.Row():
|
|
|
816 |
inputs=[wacustom_config, wamediabool],
|
817 |
outputs=[waerror_box, wagame_log, wadescription, wachoices, wacustom_config, wagame_session, wamedia]
|
818 |
)
|
819 |
+
|
820 |
+
with gr.Tab("Config With Minimal 3D considered"):
|
821 |
+
gr.HTML("Placeholder for Config with 3D assets")
|
822 |
+
|
823 |
with gr.Tab("Custom JS Config Creator"):
|
824 |
+
gr.HTML("-- Incomplete -- Companion Space for zerogpu / client api workflow planning for a way to send a zip to the Basic Game Engine at the bottom of https://huggingface.co/spaces/KwabsHug/TestSvelteStatic (Also to test how much can be done majority on cpu)")
|
825 |
with gr.Tab("Simple Config Creator"):
|
826 |
inventory_items = gr.State([])
|
827 |
skills_items = gr.State([])
|
|
|
949 |
gr.HTML("Visual Effects - eg. explosion can turn all items white for a moment, losing conciousness blurs whole screen")
|
950 |
gr.HTML("Placeholder for huggingface spaces that can assist - https://huggingface.co/spaces/EPFL-VILAB/4M, https://huggingface.co/spaces/EPFL-VILAB/MultiMAE ")
|
951 |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
|
952 |
+
|
953 |
+
with gr.Tab():
|
954 |
+
gr.HTML("Social media that shows possiblities")
|
955 |
+
gr.HTML("https://x.com/blizaine")
|
956 |
|
957 |
with gr.Tab("Other Considerations"):
|
958 |
with gr.Tab("General"):
|
|
|
977 |
gr.HTML("Speed - Groq, SambaNova, https://www.etched.com/announcing-etched ")
|
978 |
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?")
|
979 |
with gr.Tab("Asset loading test"):
|
980 |
+
gr.HTML("SDXL, SVD and Stable Audio used for the test assets (For commercial use need a licence)")
|
981 |
with gr.Row():
|
982 |
gr.Image(value="testmedia/Flash scribble SDXL - random squiggles as roads.webp")
|
983 |
gr.Video(value="testmedia/SVD - random squiggles as roads video 004484.mp4")
|