File size: 2,056 Bytes
f1c5f21
c23d9d1
e4a3910
fedcd28
2a13638
e4a3910
 
 
 
fedcd28
2a13638
e4a3910
 
 
 
 
 
 
 
 
 
 
 
2a13638
fedcd28
 
 
 
 
 
2a13638
fedcd28
2a13638
 
 
fedcd28
 
 
 
 
 
2a13638
fedcd28
2a13638
 
 
 
c23d9d1
2a13638
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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)

@spaces.GPU
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()