mhdhrubo commited on
Commit
b4c25fe
1 Parent(s): 21673ed

adding requirements.txt

Browse files
Files changed (2) hide show
  1. app.py +11 -4
  2. requirements.txt +0 -0
app.py CHANGED
@@ -1,6 +1,10 @@
1
  from fastai.vision.all import load_learner
2
  import gradio as gr
3
 
 
 
 
 
4
  musical_instruments = (
5
  'Bansuri',
6
  'Harmonium',
@@ -14,7 +18,10 @@ musical_instruments = (
14
  'Tanpura'
15
  )
16
 
17
- model = load_learner(f"models/musical-instrument-recognizer-v6.pkl")
 
 
 
18
 
19
  def recognize_image(image):
20
  pred, idx, probs = model.predict(image)
@@ -22,8 +29,8 @@ def recognize_image(image):
22
 
23
 
24
 
25
- image = gr.inputs.Image(shape=(192,192))
26
- label = gr.outputs.Label()
27
  examples = [
28
  'test_data/bansuri.jfif',
29
  'test_data/harmonium.jfif',
@@ -38,4 +45,4 @@ examples = [
38
  ]
39
 
40
  iface = gr.Interface(fn=recognize_image, inputs = image, outputs= label, examples = examples)
41
- iface.launch(inline =False, share = True)
 
1
  from fastai.vision.all import load_learner
2
  import gradio as gr
3
 
4
+ import pathlib
5
+ temp = pathlib.PosixPath
6
+ pathlib.PosixPath = pathlib.WindowsPath
7
+
8
  musical_instruments = (
9
  'Bansuri',
10
  'Harmonium',
 
18
  'Tanpura'
19
  )
20
 
21
+
22
+
23
+ model = load_learner("models/musical-instrument-recognizer-v6.pkl")
24
+
25
 
26
  def recognize_image(image):
27
  pred, idx, probs = model.predict(image)
 
29
 
30
 
31
 
32
+ image = gr.Image()
33
+ label = gr.Label()
34
  examples = [
35
  'test_data/bansuri.jfif',
36
  'test_data/harmonium.jfif',
 
45
  ]
46
 
47
  iface = gr.Interface(fn=recognize_image, inputs = image, outputs= label, examples = examples)
48
+ iface.launch(inline =False, share = False)
requirements.txt ADDED
Binary file (60 Bytes). View file