import gradio as gr from convert import convert DESCRIPTION = """ [Here is the full version of the converter by Huggingface official.](https://huggingface.co/spaces/diffusers/sdxl-to-diffusers) The steps are the following: - 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. - Input a model id from the Hub - Input the filename from the root dir of the repo that you would like to convert, e.g. 'xl-pruned.safetensors' - Click "Submit" - 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 🔥 ⚠️ 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. ⚠️⚠️ Note that if you want your model to work with Huggingface's Inference API, you will need to create a model card (README.md) after the conversion. If you have a good PC, you can use the following script in your local environment. [kiyohken2000 / convert-safetensors-to-diffusers](https://github.com/kiyohken2000/convert-safetensors-to-diffusers) """ demo = gr.Interface( title="Convert any Stable Diffusion XL checkpoint to Diffusers and open a PR", description=DESCRIPTION, allow_flagging="never", article="Check out the [Diffusers repo on GitHub](https://github.com/huggingface/diffusers)", inputs=[ gr.Text(max_lines=1, label="your_hf_token"), gr.Text(max_lines=1, label="model_id"), gr.Text(max_lines=1, label="filename"), ], outputs=[gr.Markdown(label="output")], fn=convert, ).queue(max_size=1) demo.launch(show_api=True)