DanielFD commited on
Commit
637dd18
·
1 Parent(s): c81365f

Upload 4 files

Browse files
ML_Model_Size_Frames.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73013558f49ded38bc66d1b0076f14391c64c047baa5622d2cf6e640b563efcc
3
+ size 14353
ML_Model_Size_Frames_config ADDED
Binary file (158 kB). View file
 
app.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import pycaret
3
+ from pycaret.classification import *
4
+ import gradio as gr
5
+
6
+ model = load_model('ML_Model_Size_Frames')
7
+ load_config('/ML_Model_Size_Frames_config')
8
+
9
+ def ml_classication(Height,Working_Distance,IPD_Infinity,IPD_WD,IPD_300mm):
10
+ columns = ['Frame_Size_Refractives','Height','Working_Distance','IPD_Infinity','IPD_WD','IPD_300mm']
11
+ df = pd.DataFrame(columns=columns)
12
+ df = df.append({'Height':Height,
13
+ 'Working_Distance': Working_Distance, 'IPD_Infinity': IPD_Infinity,
14
+ 'IPD_WD':IPD_WD, 'IPD_300mm': IPD_300mm}, ignore_index=True)
15
+ new_prediction = predict_model(model, data=df)
16
+ prediction = new_prediction['Label'].iloc[0]
17
+ score = new_prediction['Score'].iloc[0]
18
+ #
19
+ return prediction, score
20
+
21
+
22
+ inputs = [
23
+ gr.Slider(120, 220, 175, label="Height [cm]"),
24
+ gr.Slider(400, 600, 300, label="Working Distance [mm]"),
25
+ gr.Slider(45, 100, 60, label='IPD Infinity [mm]'),
26
+ gr.Slider(45, 100, 60, label="IPD Working Distance [mm]"),
27
+ gr.Slider(45, 100, 60, label="IPD 300 mm [mm]"),
28
+ ]
29
+ outputs = [
30
+ gr.Text(label='Frame Size'),
31
+ gr.Text(label = 'Score'),
32
+ ]
33
+
34
+ demo = gr.Interface(
35
+ fn=ml_classication,
36
+ inputs=inputs,
37
+ outputs=outputs,
38
+ examples=[
39
+ [163, 490, 62.0, 58.0, 56.0],
40
+ [180, 510, 63.5, 59.5, 57.5],
41
+ ],
42
+ cache_examples=True,
43
+ )
44
+
45
+ if __name__ == "__main__":
46
+ demo.launch()
47
+
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==3.8.1
2
+ pandas==1.4.4
3
+ pycaret==2.2.2