File size: 1,290 Bytes
6eeeea7 7646ee6 0d5240c 7646ee6 6eeeea7 0d5240c 7049351 0d5240c 7646ee6 0d5240c 7646ee6 0d5240c 7646ee6 0d5240c 7646ee6 0d5240c 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 |
import gradio as gr
import os
from huggingface_hub import InferenceClient
from PIL import Image
# Load token from environment
token = os.environ["HF_TOKEN"]
# Setup inference client
client = InferenceClient(
model="artificialguybr/TshirtDesignRedmond-V2",
provider="fal-ai",
token=token,
)
# Trigger words as per model instructions
trigger_word = "T shirt design, TshirtDesignAF, "
def generate_image(prompt):
full_prompt = f"{prompt} {trigger_word}"
print("Generating image with prompt:", full_prompt)
# Generate image
image = client.text_to_image(
full_prompt,
params={
"negative_prompt": "(worst quality, low quality, normal quality, lowres, low details...)",
"num_inference_steps": 30,
"scheduler": "DPMSolverMultistepScheduler",
}
)
return image
# Gradio interface
iface = gr.Interface(
fn=generate_image,
inputs=gr.Textbox(lines=2, placeholder="Type your prompt here..."),
outputs="image",
title="TShirt Design XL Image Generator",
description="Powered by Redmond.AI — Generates T-shirt designs from prompts. Trigger tags: 'T shirt design, TshirtDesignAF'.",
examples=[["Cute Panda"], ["Skull"]]
)
print("Launching Gradio interface...")
iface.launch() |