Spaces:
Running
Running
File size: 1,994 Bytes
3f6c6eb f05400f 3f6c6eb f05400f 3f6c6eb f05400f 3f6c6eb f05400f 3f6c6eb |
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 54 55 56 57 |
import gradio as gr
from models import generate_image, MODEL_ID
from config import APPLE_TENCENT_THEME
def create_ui():
with gr.Blocks(title=f"Tencent HunyuanImage-3.0 Demo", theme=APPLE_TENCENT_THEME) as demo:
gr.HTML(
f"<div style='text-align: center; max-width: 700px; margin: 0 auto;'>"
f"<h1>Tencent {MODEL_ID.split('/')[-1]}</h1>"
f"<p>Generate images using Tencent's state-of-the-art model hosted by FAL AI.</p>"
f"Built with <a href='https://huggingface.co/spaces/akhaliq/anycoder' target='_blank'>anycoder</a>"
f"</div>"
)
with gr.Row():
with gr.Column(scale=1):
prompt_input = gr.Textbox(
label="Prompt",
placeholder="e.g., A detailed watercolor painting of a small red fox sleeping on a pile of autumn leaves.",
lines=4
)
generate_btn = gr.Button("🎨 Generate Image", variant="primary")
with gr.Column(scale=1):
output_image = gr.Image(
label="Generated Image",
height=512,
width=512,
interactive=False,
show_download_button=True
)
# Set up the event listener
generate_btn.click(
fn=generate_image,
inputs=[prompt_input],
outputs=[output_image],
queue=True
)
# Example usage guidance - only the Fox example is kept
gr.Examples(
examples=[
"A detailed watercolor painting of a small red fox sleeping on a pile of autumn leaves."
],
inputs=prompt_input,
outputs=output_image,
fn=generate_image,
cache_examples=False,
)
return demo
if __name__ == "__main__":
app = create_ui()
app.queue()
app.launch() |