| import gradio as gr |
|
|
| with gr.Blocks(fill_height=True) as demo: |
| |
| with gr.Sidebar(): |
| gr.Markdown("# Inference Provider") |
| gr.Markdown( |
| "This Space showcases the martinletec55/Katie2 model.\n" |
| "Sign in with your Hugging Face account to use this API." |
| ) |
| login_btn = gr.LoginButton("Sign in") |
|
|
| |
| gr.Markdown("## Generate") |
|
|
| with gr.Row(): |
| prompt = gr.Textbox( |
| label="Prompt", |
| placeholder="Describe what you want...", |
| lines=3 |
| ) |
|
|
| with gr.Row(): |
| steps = gr.Slider(1, 50, value=20, step=1, label="Steps") |
| guidance = gr.Slider(1, 10, value=4, step=0.5, label="Guidance Scale") |
|
|
| generate_btn = gr.Button("Generate", variant="primary") |
|
|
| output_image = gr.Image(label="Result") |
|
|
| |
| model = gr.load( |
| "martinletec55/Katie2", |
| src="huggingface", |
| accept_token=login_btn, |
| provider="auto" |
| ) |
|
|
| |
| generate_btn.click( |
| fn=model, |
| inputs=[prompt, steps, guidance], |
| outputs=output_image |
| ) |
|
|
| demo.launch() |