Spaces:
Runtime error
Runtime error
import gradio as gr | |
import time | |
import os | |
def convert_checkpoint(url, name): | |
try: | |
os.system(f"wget {url} --content-disposition -O {name}.safetensors") | |
checkpoint_path = f"{name}.safetensors" | |
dump_path =f"/home/user/app/{name}" | |
cmd = [ | |
"python3", | |
"diffusers/scripts/convert_original_stable_diffusion_to_diffusers.py", # Replace with the name of your script | |
"--checkpoint_path", checkpoint_path, | |
"--scheduler_type euler-ancestral", | |
"--image_size 512 ", | |
"--prediction_type epsilon", | |
"--device cpu", | |
"--from_safetensors", | |
"--to_safetensors", | |
"--dump_path", dump_path | |
] | |
result = os.system(" ".join(cmd)) | |
output = result | |
os.remove(checkpoint_path) | |
except Exception as e: | |
output = str(e) | |
return output | |
iface = gr.Interface( | |
fn=convert_checkpoint, | |
inputs=[ | |
gr.inputs.Textbox(label="URL"), | |
gr.inputs.Textbox(label="Name") | |
], | |
outputs=gr.outputs.Textbox() | |
) | |
iface.launch() |