Spaces:
Running
on
Zero
Running
on
Zero
import gradio as gr | |
from file_explorer_and_upload import * | |
from state_prompt_fileman_UI_functions import * | |
from my_text_game_engine_attempt import display_website | |
def TestGradioClientQwen270b(text): | |
# client = Client("Qwen/Qwen2-72B-Instruct") | |
# result = client.predict( | |
# query=text, #"Hello!!", | |
# history=[], | |
# system="You are a helpful assistant.", | |
# api_name="/model_chat" | |
# ) | |
client = Client("huggingface-projects/gemma-2-9b-it") | |
result = client.predict( | |
message=text, #"Hello!!", | |
max_new_tokens=1024, | |
temperature=0.6, | |
top_p=0.9, | |
top_k=50, | |
repetition_penalty=1.2, | |
api_name="/chat" | |
) | |
#print(result) | |
#print(result[1][0]) #All messages in the conversation | |
#print(result[2]) # System prompt | |
return result #result[1][0][1] # If supporting conversations this needs to return the last message instead | |
def SPFManJLget_config_part(config_json, location, part): | |
if not config_json: | |
return {"error": "No configuration provided."} | |
try: | |
config = json.loads(config_json) | |
location_config = config.get(location, {}) | |
return location_config.get(part, {"error": f"Part '{part}' not found in '{location}' configuration."}) | |
except json.JSONDecodeError: | |
return {"error": "Invalid JSON format."} | |
def SPFManJLupdate_location_choices(config_json): | |
if not config_json: | |
return gr.update(choices=[], value=""), gr.update(choices=[], value="") | |
try: | |
config = json.loads(config_json) | |
locations = list(config.keys()) | |
return (gr.update(choices=locations, value=locations[0] if locations else ""), | |
gr.update(choices=[], value="")) | |
except json.JSONDecodeError: | |
return gr.update(choices=[], value=""), gr.update(choices=[], value="") | |
def SPFManJLupdate_part_choices(config_json, location): | |
if not config_json or not location: | |
return gr.update(choices=[], value="") | |
try: | |
config = json.loads(config_json) | |
location_config = config.get(location, {}) | |
parts = list(location_config.keys()) | |
return gr.update(choices=parts, value=parts[0] if parts else "") | |
except json.JSONDecodeError: | |
return gr.update(choices=[], value="") | |
def SPFManJLPromptSuggestionGradClient(config, additionalnotes): | |
prompt = f"Here is a config for a game and our job is to poulate the media field to fit the context: \n{config} \nadditional information from the user: \n{additionalnotes}" | |
FinalOutput = TestGradioClientQwen270b(text=prompt) | |
return FinalOutput | |
SPFManload_state() | |
def ui_gr_media_management_acc(): | |
with gr.Accordion("Incomplete Media Management Assist - click to open", open=False) as filemanager: | |
gr.HTML("Make Files and Text ideas for the field and paste <br>When Space is restarted it will clear - zip export and import will be added later") | |
#with gr.Tab("Media Management Assistance"): #, open=False): | |
with gr.Accordion("Some Idea / Inspiration Sources / Demos", open=False): | |
with gr.Row(): | |
gr.HTML("Licenses for the spaces still to be evaluated - June 2024 <br> Users to follow with cool spaces - <br>https://huggingface.co/osanseviero - https://huggingface.co/spaces/osanseviero/TheMLGame <br>https://huggingface.co/jbilcke-hf <br>https://huggingface.co/dylanebert <br>https://huggingface.co/fffiloni <br>https://huggingface.co/artificialguybr <br>https://huggingface.co/radames <br>https://huggingface.co/multimodalart, ") | |
gr.HTML("Some Youtube Channels to keep up with updates <br><br>https://www.youtube.com/@lev-selector <br>https://www.youtube.com/@fahdmirza/videos") | |
gr.HTML("Social media that shows possiblities <br><br>https://www.reddit.com/r/aivideo/ https://www.reddit.com/r/StableDiffusion/ https://www.reddit.com/r/midjourney/ https://x.com/blizaine https://www.reddit.com/r/singularity/comments/1ead7vp/not_sure_if_this_is_the_right_place_to_post_but_i/ https://www.reddit.com/r/singularity/comments/1ebpra6/the_big_reveal_book_trailer_made_with_runway_gen3/ https://www.reddit.com/r/LocalLLaMA/comments/1e3aboz/folks_with_one_24gb_gpu_you_can_use_an_llm_sdxl/ <br>https://www.reddit.com/r/singularity/comments/1f81ira/utilizing_ai_in_solo_game_development_my/ <br>https://www.reddit.com/r/singularity/comments/1fhe402/another_runawaymls_vid_to_vid_testing_for_first/ <br>https://www.reddit.com/r/singularity/comments/1fh08nz/runawaymls_new_videotovideo_feature_is_crazy/ <br> https://www.reddit.com/r/singularity/comments/1fe4rkv/6_chinese_ai_video_generator_comparisons_hailuo/") | |
with gr.Accordion("Upload Files for config", open=False): | |
gr.Markdown("# Media Saver and Explorer (refresh file list to be resolved - for now upload all files and reload the space - they persist as long as the space creator doesnt reset/update the space - will add manual clear options later)") | |
with gr.Tab("Upload Files"): | |
file_input = gr.File(label="Choose File to Upload") | |
save_output = gr.Textbox(label="Upload Status") | |
with gr.Tab("File Explorer"): | |
file_explorer = gr.FileExplorer( | |
root_dir=SAVE_DIR, | |
glob="*.*", | |
file_count="single", | |
height=300, | |
label="Select a file to view" | |
) | |
with gr.Row(): | |
refresh_button = gr.Button("Refresh", scale=1) | |
view_button = gr.Button("View File") | |
image_output = gr.Image(label="Image Output", type="pil") | |
audio_output = gr.Audio(label="Audio Output") | |
video_output = gr.Video(label="Video Output") | |
error_output = gr.Textbox(label="Error") | |
file_input.upload( | |
save_file, | |
inputs=file_input, | |
outputs=[save_output, file_explorer, file_input] | |
) | |
view_button.click( | |
view_file, | |
inputs=file_explorer, | |
outputs=[image_output, audio_output, video_output, error_output] | |
) | |
refresh_button.click( | |
refresh_file_explorer, | |
outputs=file_explorer | |
) | |
with gr.Tab("Batch add files to config"): | |
gr.HTML("Placeholder for Config parser to allow dropdowns for the media parts of the config inserted to make assigning media quick") | |
gr.HTML("Placeholder for Config parser to allow for current zerospace creation and placement into the config (LLM can give list of media but still have to figure out workflow from there)") | |
gr.Interface(import_config_with_media, inputs=["file"], outputs=["code", "text"], description="Uploads the files needed for your config and present config for loading somewhere else") | |
gr.HTML("Placeholder for clearing uploaded assets (public space and temporary persistence = sharing and space problems)") | |
with gr.Tab("Using Embedded HF spaces / Premade files in external sources"): | |
gr.HTML("Generate the files and then sort and manage them in their appropriate field in the config") | |
gr.HTML("Currently - need to create then save to pc then reupload to use here in test tab") | |
gr.HTML("Whole game engine in a space? - https://huggingface.co/spaces/thomwolf/test_godot_editor <br><br> https://huggingface.co/godot-demo https://huggingface.co/spaces/thomwolf/test_godot") | |
with gr.Accordion("Media Suggestions based on config"): | |
#gr.Interface( , description="Load a config and get some prompt ideas") | |
gr.HTML("Either duplicate the interface on the api side or move it out so that both sides can use it") | |
with gr.Tab("Text-based"): | |
gr.HTML("Some Benchmark Leaderboards - https://huggingface.co/spaces/allenai/ZebraLogic | https://huggingface.co/spaces/allenai/WildBench https://scale.com/leaderboard https://livebench.ai") | |
with gr.Accordion("LLM HF Spaces/Sites (Click Here to Open) - Ask for a story and suggestions based on the autoconfig", open=False): | |
with gr.Row(): | |
linktochat = gr.Dropdown(choices=[ "--Long Output--", "https://thudm-longwriter.hf.space", | |
"--Function Calling--", "https://groq-demo-groq-tool-use.hf.space", | |
"--Multiple Models--", "https://huggingface.co/spaces/nvidia/minitron", "https://lmsys-gpt-4o-mini-battles.hf.space", "https://labs.perplexity.ai/", "https://chat.lmsys.org", "https://sdk.vercel.ai/docs", "https://cyzgab-catch-me-if-you-can.hf.space", | |
"--11B and above--", "https://llamameta-llama3-1-405b.static.hf.space", "https://qwen-qwen-max-0428.hf.space", "https://cohereforai-c4ai-command-r-plus.hf.space", "https://qwen-qwen1-5-110b-chat-demo.hf.space", | |
"--70B and above--", "https://cognitivecomputations-chat.hf.space", "https://snowflake-snowflake-arctic-st-demo.hf.space", "https://databricks-dbrx-instruct.hf.space", "https://qwen-qwen1-5-72b-chat.hf.space", | |
"--20B and above--", "https://grin-moe-demo-grin-moe.hf.space", "https://gokaygokay-gemma-2-llamacpp.hf.space", "https://01-ai-yi-34b-chat.hf.space", "https://cohereforai-c4ai-command-r-v01.hf.space", "https://ehristoforu-mixtral-46-7b-chat.hf.space", "https://mosaicml-mpt-30b-chat.hf.space", | |
"--7B and above--", "https://vilarin-mistral-nemo.hf.space", "https://arcee-ai-arcee-scribe.hf.space", "https://vilarin-llama-3-1-8b-instruct.hf.space", "https://ysharma-chat-with-meta-llama3-8b.hf.space", "https://qwen-qwen1-5-moe-a2-7b-chat-demo.hf.space", "https://deepseek-ai-deepseek-coder-7b-instruct.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", | |
"--1B and above--", "https://huggingface.co/spaces/eswardivi/Phi-3-mini-128k-instruct", "https://eswardivi-phi-3-mini-4k-instruct.hf.space", "https://stabilityai-stablelm-2-1-6b-zephyr.hf.space", | |
"--under 1B--", | |
"--unorganised--", "https://ysharma-zephyr-playground.hf.space", "https://huggingfaceh4-zephyr-chat.hf.space", "https://ysharma-explore-llamav2-with-tgi.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) | |
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") | |
chatspace = gr.HTML("Chat Space Chosen will load here") | |
chatspacebtn.click(display_website, inputs=linktochat, outputs=chatspace) | |
with gr.Tab("Media Understanding"): | |
gr.HTML("NPC Response Engines? Camera, Shopkeeper, Companion, Enemies, etc.") | |
with gr.Accordion("Media understanding model Spaces/Sites (Click Here to Open)", open=False): | |
with gr.Row(): | |
linktomediaunderstandingspace = gr.Dropdown(choices=[ "--Weak Audio Understanding = Audio to text, Weak Video Understanding = Video to Image to Image Understanding", "https://skalskip-florence-2-video.hf.space", "https://kingnish-opengpt-4o.hf.space", | |
"--Audio Understanding--", "https://jan-hq-llama3-1-s-v0-2.hf.space", | |
"--Video Understanding--", "https://ivgsz-flash-vstream-demo.hf.space", | |
"--Image Understanding--", "https://gokaygokay-flux-prompt-generator.hf.space", "https://gokaygokay-florence-2.hf.space", "https://vilarin-vl-chatbox.hf.space", "https://qnguyen3-nanollava.hf.space", "https://skalskip-better-florence-2.hf.space", "https://merve-llava-interleave.hf.space", | |
"--Img-to-img Understanding--", "https://merve-draw-to-search-art.hf.space", | |
"--Image Understanding without conversation--", "https://epfl-vilab-4m.hf.space", "https://epfl-vilab-multimae.hf.space", "https://gokaygokay-sd3-long-captioner.hf.space" ], | |
label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True) | |
mediaunderstandingspacebtn = gr.Button("Use the chosen URL to load interface with a media understanding space") | |
mediaunderstandingspace = gr.HTML("Mdeia Understanding Space Chosen will load here") | |
mediaunderstandingspacebtn.click(display_website, inputs=linktomediaunderstandingspace, outputs=mediaunderstandingspace) | |
gr.HTML("Image Caption = https://huggingface.co/spaces/microsoft/Promptist (Prompt Lengthen) ") | |
with gr.Tab("Images"): | |
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): | |
# with gr.Tabs("General"): | |
with gr.Row(): | |
linktoimagegen = gr.Dropdown(choices=["--Text-Interleaved--", "https://ethanchern-anole.hf.space", | |
"--Hidden Image--", "https://ap123-illusiondiffusion.hf.space", | |
"--Panorama--", "https://gokaygokay-360panoimage.hf.space", | |
"--General--", "https://pixart-alpha-pixart-sigma.hf.space", "https://stabilityai-stable-diffusion-3-medium.hf.space", "https://prodia-sdxl-stable-diffusion-xl.hf.space", "https://prodia-fast-stable-diffusion.hf.space", "https://bytedance-hyper-sdxl-1step-t2i.hf.space", "https://multimodalart-cosxl.hf.space", "https://cagliostrolab-animagine-xl-3-1.hf.space", "https://stabilityai-stable-diffusion.hf.space", | |
"--Speed--", "https://radames-real-time-text-to-image-sdxl-lightning.hf.space", "https://ap123-sdxl-lightning.hf.space", | |
"--LORA Support--", "https://multimodalart-flux-lora-the-explorer.hf.space", "https://artificialguybr-artificialguybr-demo-lora.hf.space", "https://artificialguybr-studio-ghibli-lora-sdxl.hf.space", "https://artificialguybr-pixel-art-generator.hf.space", "https://fffiloni-sdxl-control-loras.hf.space", "https://ehristoforu-dalle-3-xl-lora-v2.hf.space", | |
"--Image to Image--", "https://gokaygokay-kolorsplusplus.hf.space", "https://lllyasviel-ic-light.hf.space", "https://gparmar-img2img-turbo-sketch.hf.space", | |
"--Upscaler--", "https://gokaygokay-tile-upscaler.hf.space", | |
"--Control of Pose--", "https://instantx-instantid.hf.space", "https://modelscope-transferanything.hf.space", "https://okaris-omni-zero.hf.space" | |
"--Control of Shapes--", "https://linoyts-scribble-sdxl-flash.hf.space", | |
"--Control of Text--", "", | |
"--Clothing Try on demos--", "https://kwai-kolors-kolors-virtual-try-on.hf.space", | |
"--Foreign Language Input--", "https://gokaygokay-kolors.hf.space"], label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True) | |
imagegenspacebtn = gr.Button("Use the chosen URL to load interface with a image generation model") | |
imagegenspace = gr.HTML("Image Space Chosen will load here") | |
imagegenspacebtn.click(display_website, inputs=linktoimagegen, outputs=imagegenspace) | |
linkstobecollectednoembed = "https://artgan-diffusion-api.hf.space", "https://multimodalart-stable-cascade.hf.space", "https://google-sdxl.hf.space", "https://visionmaze-magic-me.hf.space", "https://segmind-segmind-stable-diffusion.hf.space", "https://simianluo-latent-consistency-model.hf.space", | |
gr.HTML("Concept Art, UI elements, Static/3D Characters, Environments and Objects") | |
gr.HTML("Images Generation General (3rd Party) = https://www.craiyon.com/") | |
gr.HTML("Images Generation Posters with text - https://huggingface.co/spaces/GlyphByT5/Glyph-SDXL-v2") | |
gr.HTML("SVG Generation = Coding models / SOTA LLM ") | |
gr.HTML("Images Generation - Upscaling - https://huggingface.co/spaces/gokaygokay/Tile-Upscaler") | |
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>") | |
gr.HTML("Upscalers (save data transfer costs? highly detailed characters?) - https://huggingface.co/spaces/gokaygokay/AuraSR") | |
gr.HTML("Placeholder for huggingface spaces that can assist ") | |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist") | |
with gr.Tab("Video"): | |
with gr.Accordion("Video Spaces/Sites (Click Here to Open)", open=False): | |
with gr.Row(): | |
linktovideogenspace = gr.Dropdown(choices=["--Texttovid--", "https://kingnish-instant-video.hf.space", | |
"--General--", "https://zheyangqin-vader.hf.space", "https://kadirnar-open-sora.hf.space", | |
"--Talking Portrait--", "https://fffiloni-tts-hallo-talking-portrait.hf.space", | |
"--Gif / ImgtoImg based video--", "https://wangfuyun-animatelcm-svd.hf.space", "https://bytedance-animatediff-lightning.hf.space", "https://wangfuyun-animatelcm.hf.space", "https://guoyww-animatediff.hf.space",], | |
label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True) | |
videogenspacebtn = gr.Button("Use the chosen URL to load interface with video generation") | |
videogenspace = gr.HTML("Video Space Chosen will load here") | |
videogenspacebtn.click(display_website, inputs=linktovideogenspace, outputs=videogenspace) | |
gr.HTML("Cutscenes, Tutorials, Trailers") | |
gr.HTML("Portrait Video eg. Solo Taking NPC - https://huggingface.co/spaces/fffiloni/tts-hallo-talking-portrait (Image + Audio and combination) https://huggingface.co/spaces/KwaiVGI/LivePortrait (Non verbal communication eg. in a library, when running from a pursuer)") | |
gr.HTML("Placeholder for huggingface spaces that can assist - https://huggingface.co/spaces/KingNish/Instant-Video, https://huggingface.co/spaces/multimodalart/stable-video-diffusion, https://huggingface.co/spaces/multimodalart/stable-video-diffusion") | |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist") | |
gr.HTML("3rd Party / Closed Source - https://runwayml.com/ <br>") | |
with gr.Tab("Animations (for lower resource use)"): | |
gr.HTML("Characters, Environments, Objects") | |
gr.HTML("Placeholder for huggingface spaces that can assist - image as 3d object in video https://huggingface.co/spaces/ashawkey/LGM") | |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist") | |
with gr.Tab("Audio"): | |
with gr.Accordion("Audio Spaces/Sites (Click Here to Open)", open=False): | |
with gr.Row(): | |
linktoaudiogenspace = gr.Dropdown(choices=["General", "https://artificialguybr-stable-audio-open-zero.hf.space", "", | |
"--Talking Portrait--","https://fffiloni-tts-hallo-talking-portrait.hf.space"], | |
label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True) | |
audiogenspacebtn = gr.Button("Use the chosen URL to load interface with audio generation") | |
audiogenspace = gr.HTML("Audio Space Chosen will load here") | |
audiogenspacebtn.click(display_website, inputs=linktoaudiogenspace, outputs=audiogenspace) | |
gr.HTML("Music - Background, Interactive, Cutscene, Menu <br>Sound Effects - Environment, character, action (environmental triggered by user eg. gun), UI <br>Speech - Dialouge, narration, voiceover <br>The new render function means the Config can be made and iframe/api functions can be ordered as neccessary based on the part of the config that needs it to streamline workflows based on current state of config ") | |
gr.HTML("Placeholder for huggingface spaces that can assist") | |
gr.HTML("Audio Sound Effects - https://huggingface.co/spaces/artificialguybr/Stable-Audio-Open-Zero") | |
gr.HTML("Voices - Voice clone eg. actors part of your project - https://huggingface.co/spaces/tonyassi/voice-clone") | |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist") | |
gr.HTML("3rd Party / Closed Source - https://suno.com/ <br>https://www.udio.com/") | |
with gr.Tab("3D"): | |
with gr.Accordion("3D Model Spaces/Sites (Click Here to Open)", open=False): | |
with gr.Row(): | |
linktoThreedModel = gr.Dropdown(choices=["--Image prompt--", "https://vast-ai-charactergen.hf.space" | |
"--Video prompt--", "https://facebook-vggsfm.hf.space", | |
"--Text prompt--", "https://wuvin-unique3d.hf.space", "https://stabilityai-triposr.hf.space", "https://hysts-shap-e.hf.space", "https://tencentarc-instantmesh.hf.space", "https://ashawkey-lgm.hf.space", "https://dylanebert-lgm-mini.hf.space", "https://dylanebert-splat-to-mesh.hf.space", "https://dylanebert-multi-view-diffusion.hf.space"], label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True) | |
ThreedModelspacebtn = gr.Button("Use the chosen URL to load interface with a 3D model") | |
ThreedModelspace = gr.HTML("3D Space Chosen will load here") | |
ThreedModelspacebtn.click(display_website, inputs=linktoThreedModel, outputs=ThreedModelspace) | |
gr.HTML("Characters, Environments, Objects") | |
gr.HTML("Placeholder for huggingface spaces that can assist - https://huggingface.co/spaces/dylanebert/3d-arena") | |
gr.HTML("Closed Source - https://www.meshy.ai/") | |
with gr.Tab("Fonts"): | |
gr.HTML("Style of whole game, or locations, or characters") | |
gr.HTML("Placeholder for huggingface spaces that can assist - there was a space that could make letter into pictures based on the prompt but I cant find it now") | |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist") | |
with gr.Tab("Shaders and related"): | |
with gr.Accordion("'Special Effects' Spaces/Sites (Click Here to Open)", open=False): | |
with gr.Row(): | |
linktospecialeffectsgenspace = gr.Dropdown(choices=["--Distorted Image--", "https://epfl-vilab-4m.hf.space", "https://epfl-vilab-multimae.hf.space"], | |
label="Choose/Cancel type any .hf.space link here (can also type a link)'", allow_custom_value=True) | |
specialeffectsgenspacebtn = gr.Button("Use the chosen URL to load interface with special effects generation") | |
specialeffectsgenspace = gr.HTML("Special Effects Space Chosen will load here") | |
specialeffectsgenspacebtn.click(display_website, inputs=linktospecialeffectsgenspace, outputs=specialeffectsgenspace) | |
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.") | |
gr.HTML("Post-processing Effects, material effects, Particle systems, visual feedback") | |
gr.HTML("Visual Effects - eg. explosion can turn all items white for a moment, losing conciousness blurs whole screen") | |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist") | |
with gr.Tab("NPCS"): | |
gr.HTML("For ideas on NPCS check: https://lifearchitect.ai/leta/, ") | |
with gr.Tab("Save files"): | |
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") | |
gr.HTML("Some ideas - In game websites eg. GTA esp stock markets, news; ") | |
gr.HTML("Placeholder for huggingface spaces that can assist - https://huggingface.co/nvidia/Nemotron-4-340B-Instruct (Purpose is supposed to be synthetic data generation), https://huggingface.co/spaces/gokaygokay/Gemma-2-llamacpp ") | |
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist (9b and under) <br>initial floor for testing can be https://huggingface.co/spaces/Qwen/Qwen2-0.5B-Instruct, https://huggingface.co/spaces/Qwen/Qwen2-1.5b-instruct-demo, https://huggingface.co/spaces/stabilityai/stablelm-2-1_6b-zephyr, https://huggingface.co/spaces/IndexTeam/Index-1.9B, https://huggingface.co/microsoft/Phi-3-mini-4k-instruct") | |
with gr.Tab("Diagrams"): | |
gr.HTML("Claude 3.5 sonnet is very good with mermaid graphs - can used for maps, situational explanations") | |
with gr.Tab("Maths"): | |
gr.HTML("https://huggingface.co/spaces/AI-MO/math-olympiad-solver") | |
with gr.Tab("Using gradio client / External Source as API provider"): | |
gr.HTML("State file managed and one item at time creation using gradio client") | |
with gr.Tab("Bulk Generate Assets"): | |
with gr.Tab("Load Configuration"): | |
with gr.Row(): | |
SPFManconfig_file = gr.File(label="Load Configuration File") | |
SPFManload_config_button = gr.Button("Load Configuration") | |
SPFManload_result = gr.Textbox(label="Load Result") | |
with gr.Tab("Manage Prompts"): | |
with gr.Accordion("Load the current game state that you want to add media to", open=False): | |
gr.Markdown("# Load and View Game Configuration") | |
with gr.Accordion("Click to hide config for space"): | |
SPFManJLconfig_input = gr.Textbox(label="Enter Game Configuration JSON", placeholder="Paste JSON config here", lines=4) | |
SPFManJLlocation_choice = gr.Dropdown(choices=[], label="Choose location") | |
SPFManJLpart_choice = gr.Dropdown(choices=[], label="Choose part") | |
SPFManJLconfig_view = gr.JSON(label="Configuration Details") | |
SPFManJLconfig_input.change(fn=SPFManJLupdate_location_choices, inputs=SPFManJLconfig_input, outputs=[SPFManJLlocation_choice, SPFManJLpart_choice]) | |
SPFManJLlocation_choice.change(fn=SPFManJLupdate_part_choices, inputs=[SPFManJLconfig_input, SPFManJLlocation_choice], outputs=SPFManJLpart_choice) | |
def SPFManJLupdate_config_view(config_json, location, part): | |
return SPFManJLget_config_part(config_json, location, part) | |
SPFManJLpart_choice.change(fn=SPFManJLupdate_config_view, inputs=[SPFManJLconfig_input, SPFManJLlocation_choice, SPFManJLpart_choice], outputs=SPFManJLconfig_view) | |
gr.Interface(SPFManJLPromptSuggestionGradClient, inputs=[SPFManJLconfig_view, "text"], outputs=["text"], description="Ask a random LLM for suggestions eg. bring life to the game by focusing more on the description") | |
with gr.Row(): | |
SPFManprompt_type = gr.Dropdown(["image", "audio"], label="Prompt Type") | |
SPFManprompt = gr.Textbox(label="Prompt") | |
with gr.Row(): | |
SPFManadd_button = gr.Button("Add Prompt") | |
SPFManclear_button = gr.Button("Clear Prompts") | |
SPFManauto_generate_button = gr.Button("Auto-Generate Prompt") | |
with gr.Row(): | |
SPFManprompt_output = gr.Textbox(label="Added Prompts") | |
SPFManprompt_count = gr.Number(value=0, label="Number of Prompts") | |
SPFManview_prompts_button = gr.Button("View All Prompts") | |
SPFManall_prompts_output = gr.Textbox(label="All Prompts", lines=10) | |
#SPFManconfig_view = gr.Textbox(label="Current Configuration", lines=10) | |
# New JSON input for loading configurations | |
#SPFManjson_input = gr.Textbox(label="JSON Configuration", lines=10) | |
#SPFManload_json_button = gr.Button("Load JSON Configuration") | |
# Link the button to the function | |
#SPFManload_json_button.click(SPFManload_json_configuration, inputs=[SPFManjson_input], outputs=[load_result, prompt_count]) | |
with gr.Tab("API Settings"): | |
with gr.Row(): | |
SPFManapi_provider = gr.Textbox(label="API Provider", value=lambda: SPFManstate["api_provider"]) | |
SPFMancost_per_item = gr.Number(label="Cost per Item", value=lambda: SPFManstate["cost_per_item"]) | |
SPFManupdate_api_button = gr.Button("Update API Details") | |
SPFManapi_update_result = gr.Textbox(label="API Update Result") | |
with gr.Tab("Generate Files and Media"): | |
with gr.Row(): | |
SPFManoutput_dir = gr.Textbox(label="Output Directory", value=lambda: SPFManstate["output_dir"]) | |
SPFManresume = gr.Checkbox(label="Resume from last run", value=True) | |
with gr.Row(): | |
SPFManpaid_api_checkbox = gr.Checkbox(label="Use Paid API", value=lambda: SPFManstate["is_paid_api"]) | |
SPFMancost_estimate = gr.Textbox(label="Estimated Cost") | |
SPFMangenerate_button = gr.Button("Generate Files and Media") | |
SPFManskip_button = gr.Button("Skip Current Item") | |
SPFManresults = gr.Textbox(label="Results", lines=10) | |
SPFManerror_output = gr.Textbox(label="Errors", lines=5) | |
SPFManzip_button = gr.Button("Zip Output Files") | |
SPFManzip_result = gr.Textbox(label="Zip Result") | |
SPFManload_config_button.click(SPFManload_config_file, inputs=[SPFManconfig_file], outputs=[SPFManload_result, SPFManprompt_count]) | |
SPFManadd_button.click(SPFManadd_prompt, inputs=[SPFManprompt_type, SPFManprompt], outputs=[SPFManprompt_output, SPFManprompt_count]) | |
SPFManclear_button.click(SPFManclear_prompts, outputs=[SPFManprompt_output, SPFManprompt_count]) | |
SPFManview_prompts_button.click(SPFManview_all_prompts, outputs=SPFManall_prompts_output) | |
SPFManauto_generate_button.click(SPFManauto_generate_prompt, inputs=[SPFManprompt_type], outputs=[SPFManprompt]) | |
SPFManupdate_api_button.click(SPFManupdate_api_details, inputs=[SPFManapi_provider, SPFMancost_per_item], outputs=[SPFManapi_update_result]) | |
SPFManpaid_api_checkbox.change(SPFMantoggle_paid_api, inputs=[SPFManpaid_api_checkbox], outputs=[SPFMancost_estimate]) | |
SPFMangenerate_button.click(SPFMancreate_files_with_generation, inputs=[SPFManresume], outputs=SPFManresults) | |
SPFManskip_button.click(SPFManskip_item, outputs=SPFManresults) | |
SPFManzip_button.click(SPFManzip_files, outputs=SPFManzip_result) | |
gr.Textbox(label="Configuration", value=SPFManview_config, every=1) | |
with gr.Tab("Replicate - API Definitions crucial models"): | |
gr.HTML("Many custom models set-up and the ability to set up the neccesary ones using cog <br> https://replicate.com/collections/text-to-image | https://replicate.com/collections/text-to-video | https://replicate.com/collections/audio-generation https://replicate.com/collections/text-to-speech | https://replicate.com/collections/3d-models ") | |
gr.Code("""Install Replicate’s Python client library | |
pip install replicate | |
Copy | |
Set the REPLICATE_API_TOKEN environment variable | |
export REPLICATE_API_TOKEN=<paste-your-token-here> | |
Visibility | |
Copy | |
Find your API token in your account settings. | |
Import the client | |
import replicate | |
Copy | |
Run meta/musicgen using Replicate’s API. Check out the model's schema for an overview of inputs and outputs. | |
output = replicate.run( | |
"meta/musicgen:671ac645ce5e552cc63a54a2bbff63fcf798043055d2dac5fc9e36a837eedcfb", | |
input={ | |
"top_k": 250, | |
"top_p": 0, | |
"prompt": "Edo25 major g melodies that sound triumphant and cinematic. Leading up to a crescendo that resolves in a 9th harmonic", | |
"duration": 8, | |
"temperature": 1, | |
"continuation": False, | |
"model_version": "stereo-large", | |
"output_format": "mp3", | |
"continuation_start": 0, | |
"multi_band_diffusion": False, | |
"normalization_strategy": "peak", | |
"classifier_free_guidance": 3 | |
} | |
) | |
print(output)""", language="python") | |
with gr.Tab("Cloud Computing"): | |
gr.HTML("Storage, AI api access, VMs, ") | |
with gr.Tab("Using 3rd Party Interface - free/paid"): | |
gr.HTML("General - https://artificialanalysis.ai/models/llama-3-1-instruct-405b/providers") | |
gr.HTML("Image - https://playground.com/login | https://www.midjourney.com/showcase") | |
gr.HTML("Audio - https://www.udio.com/home https://www.udio.com/pricing | https://suno.com/ ") | |
gr.HTML("Video - https://lumalabs.ai/dream-machine https://lumalabs.ai/dream-machine/pricing (free 30 gens a month) | https://klingai.com/ - https://www.reddit.com/r/singularity/comments/1fk4tgp/kling_ai_showcasing_the_use_of_the_motion_brush/ | https://www.hedra.com/") | |
gr.HTML("3D - https://www.csm.ai/ | https://www.tripo3d.ai/ | https://zoo.dev/text-to-cad") | |
gr.HTML("Multiple - https://fal.ai/pricing | ") | |
with gr.Tab("Examples of Generated Media on Reddit"): | |
gr.HTML("https://www.reddit.com/r/singularity/comments/1fknejj/facecamai_lets_anyone_convert_a_single_image_into/ <br>https://www.reddit.com/r/singularity/comments/1fjylow/tripo_v20_is_out_now_you_can_create_stunning_3d/") | |
with gr.Tab("Licensing"): | |
gr.HTML("Need to find the press release to see license eg. https://blackforestlabs.ai/announcing-black-forest-labs/") | |
return filemanager |