import gradio as gr import sys import os # Add the dist directory to Python path sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'dist')) # Import obfuscated module try: from core_logic import ( generate_speedpainting_secure, get_company_info, get_example_images, create_footer, get_custom_css ) except ImportError as e: print(f"Error: Obfuscated module not found: {e}") print("Current directory:", os.getcwd()) print("Files in dist:", os.listdir('dist') if os.path.exists('dist') else 'dist not found') sys.exit(1) # Create Gradio interface with gr.Blocks(title="Miragic Speed-Painting", theme=gr.themes.Ocean(), css=get_custom_css()) as demo: gr.Markdown("""

Miragic Speed-Painting 🎨

Upload an image to see AI create speedpainting animations!

""") gr.Markdown(get_company_info()) with gr.Row(): with gr.Column(): image_input = gr.Image( label="Upload Image", type="pil", sources=["upload", "clipboard"], height=300 ) gr.Examples( examples=get_example_images(), inputs=image_input, label="Try these examples!", examples_per_page=5 ) submit_btn = gr.Button("Generate Speedpainting 🚀", elem_classes="button-gradient") with gr.Column(): video_output = gr.Video( label="Speedpainting Result", autoplay=True, height=300 ) gr.HTML("""

If you like our Speed Painting results, please give us a ⭐ into our space!

""") signup_prompt = gr.HTML( visible=True, value="""

🚀 Want unlimited generations?

Please sign up at Miragic.ai for unlimited access to all our AI tools!

SignUp for Free 🚀
""" ) # Handle generation - Only calls the secure function, no logic here submit_btn.click( fn=generate_speedpainting_secure, inputs=[image_input], outputs=video_output ) gr.HTML('') # Footer gr.HTML(create_footer()) if __name__ == "__main__": demo.launch()