adrin commited on
Commit
3b41829
1 Parent(s): aa38de2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
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
- print(file)
8
- obj = joblib.load(file.name)
9
- _, fname = tempfile.mkstemp(prefix=file + ".skops")
 
 
 
 
 
 
 
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