adi / app.py
gaur3009's picture
Update app.py
0d5240c verified
raw
history blame
1.29 kB
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()