Spaces:
Sleeping
Sleeping
Download app.py from Gainopia/BranDevOps: direct link, hf CLI and curl.
- Browser
- Download file 2.06 kB
-
https://huggingface.co/spaces/Gainopia/BranDevOps/resolve/main/app.py
- Command line
-
hf download hf://spaces/Gainopia/BranDevOps/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Gainopia/BranDevOps/resolve/main/app.py
2.06 kB
| import gradio as gr | |
| import os | |
| from huggingface_hub import InferenceClient | |
| import spaces | |
| # استدعاء الـ Client الرسمي من Hugging Face باستخدام المفتاح السري المضاف في الـ Secrets | |
| hf_token = os.getenv("HF_TOKEN") | |
| client = InferenceClient(token=hf_token) | |
| def generate_brand_asset(prompt): | |
| if not prompt: | |
| return None | |
| try: | |
| # الاستدعاء الرسمي والمستقر لنموذج FLUX.1-schnell | |
| image = client.text_to_image( | |
| prompt, | |
| model="black-forest-labs/FLUX.1-schnell" | |
| ) | |
| return image | |
| except Exception as e: | |
| raise gr.Error(f"خطأ في الاتصال بالسيرفر: {str(e)}. تأكد من صحة الـ HF_TOKEN في الـ Secrets.") | |
| custom_css = """ | |
| footer {visibility: hidden} | |
| .gradio-container {max-width: 900px !important; margin: 0 auto;} | |
| """ | |
| with gr.Blocks(css=custom_css) as demo: | |
| gr.Markdown("<center><h1>⚡ BranDevOps: Autonomous Creative System</h1></center>") | |
| gr.Markdown("<center><h3>Generate premium logos and visual brand assets instantly via Cloud AI</h3></center>") | |
| with gr.Row(): | |
| with gr.Column(): | |
| prompt_input = gr.Textbox( | |
| label="Design Prompt", | |
| placeholder="e.g., A minimalist geometric logo design, sharp symmetrical emblem, premium luxury style, white background..." | |
| ) | |
| submit_btn = gr.Button("Generate Asset 🚀", variant="primary") | |
| gr.Markdown("💡 **Tip:** Use keywords like *Minimalist, Symmetrical, Vector, Clean background* for high-end geometric results.") | |
| with gr.Column(): | |
| image_output = gr.Image(label="Generated Output") | |
| submit_btn.click(fn=generate_brand_asset, inputs=prompt_input, outputs=image_output) | |
| gr.Markdown("---") | |
| gr.Markdown("<center><b>Looking for a complete, production-ready brand identity engineering?</b><br>Let automated systems scale your business.</center>") | |
| demo.launch() | |