Spaces:
Build error
Build error
import gradio as gr | |
from pathlib import Path | |
import tempfile | |
import joblib | |
from skops import io as sio | |
def convert(file): | |
in_file = Path(file.name) | |
obj = joblib.load(in_file) | |
if "." in in_file.name: | |
out_file = in_file.split(".")[:-1] | |
else: | |
out_file = in_file | |
out_file += ".skops" | |
_, fname = tempfile.mkstemp(suffix=out_file) | |
sio.dump(obj, fname) | |
return fname | |
with gr.Blocks() as iface: | |
file_output = gr.File() | |
upload_button = gr.UploadButton("Click to Upload a File", file_types=None, file_count="single") | |
upload_button.upload(convert, upload_button, file_output) | |
iface.launch() |