pawara101 commited on
Commit
704ea69
·
verified ·
1 Parent(s): 3183595

Upload 2 files

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. app.py +49 -0
  3. glass_pipeline.skops +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ glass_pipeline.skops filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import skops.io as sio
3
+ from skops.io import get_untrusted_types
4
+
5
+ unknown_types = get_untrusted_types(file="glass_pipeline.skops")
6
+ pipe = sio.load("glass_pipeline.skops", trusted=unknown_types)
7
+
8
+ classes = [
9
+ "None",
10
+ "Building Windows Float Processed",
11
+ "Building Windows Non Float Processed",
12
+ "Vehicle Windows Float Processed",
13
+ "Vehicle Windows Non Float Processed",
14
+ "Containers",
15
+ "Tableware",
16
+ "Headlamps",
17
+ ]
18
+
19
+
20
+ def classifier(RI, Na, Mg, Al, Si, K, Ca, Ba, Fe):
21
+ pred_glass = pipe.predict([[RI, Na, Mg, Al, Si, K, Ca, Ba, Fe]])[0]
22
+ label = f"Predicted Glass label: **{classes[pred_glass]}**"
23
+ return label
24
+
25
+
26
+ inputs = [
27
+ gr.Slider(1.51, 1.54, step=0.01, label="Refractive Index"),
28
+ gr.Slider(10, 17, step=1, label="Sodium"),
29
+ gr.Slider(0, 4.5, step=0.5, label="Magnesium"),
30
+ gr.Slider(0.3, 3.5, step=0.1, label="Aluminum"),
31
+ gr.Slider(69.8, 75.4, step=0.1, label="Silicon"),
32
+ gr.Slider(0, 6.2, step=0.1, label="Potassium"),
33
+ gr.Slider(5.4, 16.19, step=0.1, label="Calcium"),
34
+ gr.Slider(0, 3, step=0.1, label="Barium"),
35
+ gr.Slider(0, 0.5, step=0.1, label="Iron"),
36
+ ]
37
+ outputs = [gr.Label(num_top_classes=7)]
38
+
39
+ title = "Glass Classification"
40
+ description = "Enter the details to correctly identify glass type?"
41
+
42
+ demo = gr.Interface(
43
+ fn=classifier,
44
+ inputs=inputs,
45
+ outputs=outputs,
46
+ title=title,
47
+ description=description,
48
+ )
49
+ demo.launch()
glass_pipeline.skops ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd51be9208f1c2aa06a7368adb2d9f0d5c58b38dc5c77d23f98b9d1504366022
3
+ size 2991690