Delete app.py
Browse files
app.py
DELETED
|
@@ -1,93 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import sys
|
| 3 |
-
import os
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
# Add the dist directory to Python path
|
| 7 |
-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'dist'))
|
| 8 |
-
|
| 9 |
-
# Import obfuscated module
|
| 10 |
-
try:
|
| 11 |
-
from core_logic import (
|
| 12 |
-
generate_speedpainting_secure,
|
| 13 |
-
get_company_info,
|
| 14 |
-
get_example_images,
|
| 15 |
-
create_footer,
|
| 16 |
-
get_custom_css
|
| 17 |
-
)
|
| 18 |
-
except ImportError as e:
|
| 19 |
-
print(f"Error: Obfuscated module not found: {e}")
|
| 20 |
-
print("Current directory:", os.getcwd())
|
| 21 |
-
print("Files in dist:", os.listdir('dist') if os.path.exists('dist') else 'dist not found')
|
| 22 |
-
sys.exit(1)
|
| 23 |
-
|
| 24 |
-
# Create Gradio interface
|
| 25 |
-
with gr.Blocks(title="Miragic Speed-Painting", theme=gr.themes.Ocean(), css=get_custom_css()) as demo:
|
| 26 |
-
gr.Markdown("""
|
| 27 |
-
<div style="display: flex; align-items: center;">
|
| 28 |
-
<img src="https://avatars.githubusercontent.com/u/211682198?s=200&v=4" style="width: 80px; margin-right: 20px;"/>
|
| 29 |
-
<div>
|
| 30 |
-
<h1 style="margin-bottom: 0;">Miragic Speed-Painting π¨</h1>
|
| 31 |
-
<p>Upload an image to see AI create speedpainting animations!</p>
|
| 32 |
-
</div>
|
| 33 |
-
</div>
|
| 34 |
-
""")
|
| 35 |
-
|
| 36 |
-
gr.Markdown(get_company_info())
|
| 37 |
-
|
| 38 |
-
with gr.Row():
|
| 39 |
-
with gr.Column():
|
| 40 |
-
image_input = gr.Image(
|
| 41 |
-
label="Upload Image",
|
| 42 |
-
type="pil",
|
| 43 |
-
sources=["upload", "clipboard"],
|
| 44 |
-
height=300
|
| 45 |
-
)
|
| 46 |
-
|
| 47 |
-
gr.Examples(
|
| 48 |
-
examples=get_example_images(),
|
| 49 |
-
inputs=image_input,
|
| 50 |
-
label="Try these examples!",
|
| 51 |
-
examples_per_page=5
|
| 52 |
-
)
|
| 53 |
-
|
| 54 |
-
submit_btn = gr.Button("Generate Speedpainting π", elem_classes="button-gradient")
|
| 55 |
-
|
| 56 |
-
with gr.Column():
|
| 57 |
-
video_output = gr.Video(
|
| 58 |
-
label="Speedpainting Result",
|
| 59 |
-
autoplay=True,
|
| 60 |
-
height=300
|
| 61 |
-
)
|
| 62 |
-
|
| 63 |
-
gr.HTML("""
|
| 64 |
-
<div class="interaction-section">
|
| 65 |
-
<p style="margin: 5px 0;">If you like our Speed Painting results, please give us a β into our space!</p>
|
| 66 |
-
</div>
|
| 67 |
-
""")
|
| 68 |
-
|
| 69 |
-
signup_prompt = gr.HTML(
|
| 70 |
-
visible=True,
|
| 71 |
-
value="""<div class="signup-container">
|
| 72 |
-
<h3>π Want unlimited generations?</h3>
|
| 73 |
-
<p>Please sign up at Miragic.ai for unlimited access to all our AI tools!</p>
|
| 74 |
-
<a href='https://miragic.ai/products/speed-painting' target='_blank' class="signup-button">
|
| 75 |
-
SignUp for Free π
|
| 76 |
-
</a>
|
| 77 |
-
</div>"""
|
| 78 |
-
)
|
| 79 |
-
|
| 80 |
-
# Handle generation - Only calls the secure function, no logic here
|
| 81 |
-
submit_btn.click(
|
| 82 |
-
fn=generate_speedpainting_secure,
|
| 83 |
-
inputs=[image_input],
|
| 84 |
-
outputs=video_output
|
| 85 |
-
)
|
| 86 |
-
|
| 87 |
-
gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FMiragic-AI%2FMiragic-Speed-Painting"><img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FMiragic-AI%2FMiragic-Speed-Painting&label=VISITORS&labelColor=%2337d67a&countColor=%23f47373&style=plastic&labelStyle=upper" /></a>')
|
| 88 |
-
|
| 89 |
-
# Footer
|
| 90 |
-
gr.HTML(create_footer())
|
| 91 |
-
|
| 92 |
-
if __name__ == "__main__":
|
| 93 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|