Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,20 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import tempfile
|
| 3 |
import joblib
|
| 4 |
from skops import io as sio
|
| 5 |
|
| 6 |
def convert(file):
|
| 7 |
-
|
| 8 |
-
obj = joblib.load(
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
sio.dump(obj, fname)
|
| 11 |
return fname
|
| 12 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from pathlib import Path
|
| 3 |
import tempfile
|
| 4 |
import joblib
|
| 5 |
from skops import io as sio
|
| 6 |
|
| 7 |
def convert(file):
|
| 8 |
+
in_file = Path(file.name)
|
| 9 |
+
obj = joblib.load(in_file)
|
| 10 |
+
|
| 11 |
+
if "." in in_file.name:
|
| 12 |
+
out_file = in_file.split(".")[:-1]
|
| 13 |
+
else:
|
| 14 |
+
out_file = in_file
|
| 15 |
+
|
| 16 |
+
out_file += ".skops"
|
| 17 |
+
_, fname = tempfile.mkstemp(suffix=out_file)
|
| 18 |
sio.dump(obj, fname)
|
| 19 |
return fname
|
| 20 |
|