File size: 1,740 Bytes
ae526af
7646ee6
ebc700f
ae526af
 
 
 
 
 
 
 
 
 
 
0d5240c
ebc700f
7646ee6
 
e5274a3
 
 
 
 
 
 
 
 
 
ebc700f
 
ae526af
 
 
 
 
0d5240c
ae526af
7646ee6
 
 
e5274a3
ae526af
 
 
 
e5274a3
7646ee6
 
ae526af
7646ee6
 
 
 
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
52
53
from huggingface_hub import InferenceClient
from PIL import Image
import gradio as gr
import os

# Load token from environment
token = os.environ["HF_TOKEN"]

# Create the client
client = InferenceClient(
    model="artificialguybr/TshirtDesignRedmond-V2",
    provider="fal-ai",
    token=token,
)

# Trigger word for model
trigger_word = "T shirt design, TshirtDesignAF, "

def generate_image(dress_type, fabric_type, color_type, design):
    base_description = (
        f"Hyper-realistic scene of a single {color_type} {dress_type} "
        f"made of {fabric_type} with {design} printed on it, hanging neatly on a wooden hanger "
        f"against a clean matte concrete wall. The {dress_type} is centered, casting a soft natural shadow, "
        f"detailed fabric folds visible, studio lighting setup with soft diffused highlights, "
        f"4K resolution, shallow depth of field, ultra-clean minimalist aesthetic, fashion editorial style."
    )
    
    full_prompt = f"{base_description} {trigger_word}"
    print("Generating image with:", full_prompt)

    image = client.text_to_image(
        prompt=full_prompt,
        negative_prompt="(worst quality, low quality, lowres, bad photo, ...)",
        num_inference_steps=30,
        guidance_scale=7.5,
    )
    return image

iface = gr.Interface(
    fn=generate_image,
    inputs=[
        gr.Textbox(label="Dress Type"),
        gr.Textbox(label="Fabric Type"),
        gr.Textbox(label="Color Type"),
        gr.Textbox(label="Design"),
    ],
    outputs="image",
    title="TShirt Design XL Image Generator",
    description="Powered by Redmond.AI — Generate stunning T-shirt designs from simple attributes.",
)

print("Launching Gradio interface...")
iface.launch()