Spaces:
Sleeping
Sleeping
File size: 1,103 Bytes
e76f467 fcb27fb c92760e a827413 e76f467 1aa78bf 5ade8f2 f48ecfa cb202cc c92760e e76f467 cb202cc 7abaf33 e76f467 |
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 |
import os
import gradio as gr
from gradio_client import Client
def predict(prompt):
custom_model = "lichorosario/dott_remastered_style_lora_sdxl"
weight_name = "dott_style.safetensors"
api_key = os.getenv('HF_API_KEY')
client = Client("fffiloni/sd-xl-custom-model")
# Load the model
client.predict(
custom_model=custom_model,
api_name="/load_model"
)
# Infer the image
result = client.predict(
custom_model=custom_model,
weight_name=weight_name,
prompt=prompt,
inf_steps=25,
guidance_scale=12,
width=1024,
height=512,
seed=-1,
lora_weight=1,
api_name="/infer"
)
# Assuming result is a dictionary with keys 'image' and 'seed'
image = result["image"]
seed = result["seed"]
return image, seed
with gr.Blocks() as demo:
inputs = gr.Textbox(label="Prompt")
outputs = [gr.Image(label="Image"), gr.Textbox(label="Seed")]
greet_btn = gr.Button("Generate")
greet_btn.click(fn=predict, inputs=inputs, outputs=outputs)
demo.launch()
|