mizoru commited on
Commit
30f32d0
1 Parent(s): a329ad1
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from fastai.vision.all import *
4
+
5
+ from fastaudio.core.all import *
6
+
7
+ learn = load_learner('xresnet50_pitch2.pkl')
8
+
9
+ labels = learn.dls.vocab
10
+
11
+ def predict(path):
12
+
13
+ pred,pred_idx,probs = learn.predict(path)
14
+
15
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
16
+
17
+
18
+
19
+ title = "Japanese Pitch Accent Pattern Detector"
20
+
21
+ description = "Fire and Smoke classifier created with fastai. Created as a demo for Gradio and HuggingFace Spaces. Fire accidents are not uncommon and has catastrophic impact on the company both interms of social and financial terms. This application can be deployed on device and can work as 24X365 surveillance. This app classify an image into three classes. 1. Fire, 2. Smoke, 3. Neutral. Try your hand and check. For any general purpose, model file can be copied and used for the stated purpose"
22
+
23
+ article="<p style='text-align: center'><a href='https://github.com/mldurga/projects/blob/master/Fire_smoke_detector.ipynb' target='_blank'>Blog post</a></p>"
24
+
25
+ interpretation='default'
26
+
27
+ examples = []
28
+
29
+ enable_queue=True
30
+
31
+ gr.Interface(fn=predict,inputs=gr.inputs.Audio(source='mic', type='filepath'),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,interpretation=interpretation,examples=examples,enable_queue=enable_queue).launch()
32
+