File size: 1,117 Bytes
0f28a3c
4337422
 
 
 
0f28a3c
4337422
 
0f28a3c
4337422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450081e
 
 
 
 
 
 
 
4337422
a93c676
450081e
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
import gradio as gr
import requests
from PIL import Image
import io
import os 

API_URL = "https://api-inference.huggingface.co/models/Blane187/memcho-s1-ponyxl-lora-nochekaiser"
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")

    # Add Gradio examples
    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()