TrentL commited on
Commit
c66e8d4
1 Parent(s): 053acd9

File system fix.

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
- from fastai.text.all import *
3
  import pathlib
4
  from pathlib import Path
 
5
 
6
  categories = ('Korean','Vietnamese')
7
 
@@ -10,13 +10,19 @@ def predict_input_image(img):
10
  return dict(zip(categories,map(float,probs)))
11
 
12
  path = Path()
13
- temp = pathlib.PosixPath
14
- pathlib.PosixPath = pathlib.WindowsPath
 
 
 
 
 
 
 
15
 
16
  learn_inf = load_learner(path/'korean.pkl')
17
 
18
  image = gr.inputs.Image(shape=(180,180))
19
  label = gr.outputs.Label(num_top_classes=2)
20
 
21
- gr.Interface(fn=predict_input_image, inputs=image, outputs=label,interpretation='default').launch(debug='True')
22
- iface.launch()
 
1
  import gradio as gr
 
2
  import pathlib
3
  from pathlib import Path
4
+ from fastai.text.all import *
5
 
6
  categories = ('Korean','Vietnamese')
7
 
 
10
  return dict(zip(categories,map(float,probs)))
11
 
12
  path = Path()
13
+
14
+ #import pathlib
15
+ #if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
16
+ #temp = pathlib.PosixPath
17
+
18
+ plt = platform.system()
19
+ print(f"Platform : {plt}")
20
+ if plt == 'Windows':
21
+ pathlib.PosixPath = pathlib.WindowsPath
22
 
23
  learn_inf = load_learner(path/'korean.pkl')
24
 
25
  image = gr.inputs.Image(shape=(180,180))
26
  label = gr.outputs.Label(num_top_classes=2)
27
 
28
+ gr.Interface(fn=predict_input_image, inputs=image, outputs=label,interpretation='default').launch(debug='True')