Spaces:
Running
Running
| import gradio as gr | |
| # Function to convert standard Space ID to Direct App URL | |
| def get_embed_url(space_id): | |
| # 1. Convert to lowercase (Domains must be lowercase) | |
| lower_id = space_id.lower() | |
| # 2. Replace slash '/' with hyphen '-' | |
| # 3. CRITICAL FIX: Replace underscore '_' with hyphen '-' | |
| # Because subdomains cannot contain underscores | |
| domain_friendly_id = lower_id.replace("/", "-").replace("_", "-") | |
| return f"https://{domain_friendly_id}.hf.space" | |
| spaces_list = [ | |
| ("Wan2.2 Faster", "dream2589632147/Dream-wan2-2-faster-Pro"), | |
| ("LTX Video", "dream2589632147/Dream-ltx-video-distilled"), | |
| ("Qwen Image Edit", "dream2589632147/Dream-Qwen-Image-Edit-Angles"), | |
| ("Audio Separator", "dream2589632147/Dream-Audio_separator-pro"), | |
| ("Video BG Removal", "dream2589632147/Dream-video-background-removal"), | |
| ("F-E Farm", "dream2589632147/Dream-F-E-farm"), | |
| ("Video Enhancer 4K", "dream2589632147/Dream-AI_Video_Enhancer_4K"), | |
| ] | |
| with gr.Blocks(title="Dream Hub Pro") as demo: | |
| gr.Markdown("# π Dream AI Studio Pro \n ### The Ultimate AI Tools Suite") | |
| for tab_name, space_id in spaces_list: | |
| with gr.Tab(tab_name): | |
| embed_url = get_embed_url(space_id) | |
| # Displaying the Direct App URL | |
| gr.HTML(f""" | |
| <iframe | |
| src="{embed_url}" | |
| width="100%" | |
| height="900px" | |
| frameborder="0" | |
| allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; webcam; microphone" | |
| allowfullscreen> | |
| </iframe> | |
| """) | |
| if __name__ == "__main__": | |
| demo.launch() |