mizoru commited on
Commit
b4ab831
·
1 Parent(s): d31bff5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -13,10 +13,7 @@ learn = load_learner('xresnet50_pitch3.pkl')
13
 
14
  labels = learn.dls.vocab
15
 
16
- def predict(path_mic, path_upload):
17
- if path_mic:
18
- path = path_mic
19
- else: path = path_upload
20
  pred,pred_idx,probs = learn.predict(str(path))
21
 
22
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
@@ -30,8 +27,8 @@ article="<p style='text-align: center'><a href='https://github.com/mldurga/proje
30
 
31
  interpretation='default'
32
 
33
- examples = [['代わる.mp3',''],['大丈夫な.mp3',''],['','熱くない.mp3']]
34
 
35
  enable_queue=True
36
 
37
- gr.Interface(fn=predict,inputs=[gr.inputs.Audio(source='microphone', type='filepath'),gr.inputs.Audio(source='upload', type='filepath')],outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,interpretation=interpretation,examples=examples).launch(debug=True,share=True,enable_queue=enable_queue)
 
13
 
14
  labels = learn.dls.vocab
15
 
16
+ def predict(path):
 
 
 
17
  pred,pred_idx,probs = learn.predict(str(path))
18
 
19
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
 
27
 
28
  interpretation='default'
29
 
30
+ examples = ['代わる.mp3','大丈夫な.mp3','熱くない.mp3']
31
 
32
  enable_queue=True
33
 
34
+ gr.Interface(fn=predict,inputs=gr.inputs.Audio(source='microphone', type='filepath'),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,interpretation=interpretation,examples=examples).launch(debug=True,share=True,enable_queue=enable_queue)