File size: 653 Bytes
3f9cf1b
3b41829
0aa6630
f55c257
 
3f9cf1b
f55c257
3b41829
 
 
 
 
 
 
 
 
 
0aa6630
 
3f9cf1b
ef2ecb8
0aa6630
 
6f37b8e
0aa6630
 
 
3f9cf1b
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
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()