Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,20 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import joblib
|
| 3 |
from skops import io as sio
|
| 4 |
|
| 5 |
def convert(file):
|
| 6 |
print(file)
|
| 7 |
obj = joblib.load(file)
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import tempfile
|
| 3 |
import joblib
|
| 4 |
from skops import io as sio
|
| 5 |
|
| 6 |
def convert(file):
|
| 7 |
print(file)
|
| 8 |
obj = joblib.load(file)
|
| 9 |
+
_, fname = tempfile.mkstemp(prefix=file + ".skops")
|
| 10 |
+
sio.dump(obj, fname)
|
| 11 |
+
return fname
|
| 12 |
|
| 13 |
|
| 14 |
+
with gr.Blocks() as iface:
|
| 15 |
+
file_output = gr.File()
|
| 16 |
+
upload_button = gr.UploadButton("Click to Upload a File", file_types=none, file_count="single")
|
| 17 |
+
upload_button.upload(convert, upload_button, file_output)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
iface.launch()
|