| import gradio as gr |
| import requests |
| from PIL import Image |
| import io |
| import os |
|
|
| API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2FBlane187%2Fmemcho-s1-ponyxl-lora-nochekaiser%26quot%3B%3C%2Fspan%3E%3C!----%3E%3C%2Ftd%3E%3C%2Ftr%3E%3Ctr id="L8"> | | API_TOKEN = os.getenv("HF_READ_TOKEN") |
|
|
| headers = {"Authorization": f"Bearer {API_TOKEN}"} |
|
|
| def query(inputs): |
| response = requests.post(API_URL, headers=headers, json={"inputs": inputs}) |
| image_bytes = response.content |
| image = Image.open(io.BytesIO(image_bytes)) |
| return image |
|
|
| with gr.Blocks(theme="Hev832/niceandsimple") as demo: |
| gr.Markdown("# memcho-s1-ponyxl-lora-nochekaiser") |
| |
| with gr.Row(): |
| prompt_input = gr.Textbox(label="Enter a prompt", placeholder="Astronaut riding a horse") |
| generate_btn = gr.Button("Generate Image") |
| |
| output_image = gr.Image(label="Generated Image") |
|
|
| |
| gr.Examples( |
| examples=[ |
| ["memcho, blonde hair, blue eyes, blunt bangs, demon horns, fake horns, horns, short hair,"], |
| ], |
| inputs=prompt_input |
| ) |
|
|
| generate_btn.click(fn=query, inputs=prompt_input, outputs=output_image) |
|
|
| demo.launch() |
|
|