diffusers/sd-to-diffusers
73
1import gradio as gr2 3from convert import convert4 5DESCRIPTION = """6The steps are the following:7 8- Paste a read-access token from hf.co/settings/tokens. Read access is enough given that we will open a PR against the source repo.9- Input a model id from the Hub10- Input the filename from the root dir of the repo that you would like to convert, e.g. 'v2-1_768-ema-pruned.ckpt' or 'v1-5-pruned.safetensors'11- Chose which Stable Diffusion version, image size, scheduler type the model has and whether you want the "ema", or "non-ema" weights.12- Click "Submit"13- That's it! You'll get feedback if it works or not, and if it worked, you'll get the URL of the opened PR 🔥14 15⚠️ If you encounter weird error messages, please have a look into the Logs and feel free to open a PR to correct the error messages.16"""17 18demo = gr.Interface(19 title="Convert any Stable Diffusion checkpoint to Diffusers and open a PR",20 description=DESCRIPTION,21 allow_flagging="never",22 article="Check out the [Diffusers repo on GitHub](https://github.com/huggingface/diffusers)",23 inputs=[24 gr.Text(max_lines=1, label="your_hf_token"),25 gr.Text(max_lines=1, label="model_id"),26 gr.Text(max_lines=1, label="filename"),27 gr.Radio(label="Model type", choices=["v1", "v2", "ControlNet"]),28 gr.Radio(label="Sample size (px)", choices=[512, 768]),29 gr.Radio(label="Scheduler type", choices=["pndm", "heun", "euler", "dpm", "ddim"], value="dpm"),30 gr.Radio(label="Extract EMA or non-EMA?", choices=["ema", "non-ema"], value="ema"),31 ],32 outputs=[gr.Markdown(label="output")],33 fn=convert,34).queue(max_size=10, concurrency_count=1)35 36demo.launch(show_api=True)37 