zhangxunhui commited on
Commit
56287ee
1 Parent(s): 4e813d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -8,21 +8,17 @@ import gradio as gr
8
  from fastai.vision.all import *
9
  from fastai.data.all import *
10
 
 
 
 
 
 
11
  # %% app.ipynb 2
12
  learn = load_learner('model.pkl')
13
 
14
  # %% app.ipynb 3
15
  categories = ('Badminton', 'Cricket', 'Karate', 'Soccer', 'Swimming', 'Tennis', 'Wrestling')
16
 
17
- # %% app.ipynb 4
18
- import pandas as pd
19
- train_csv = pd.read_csv('dataset/train.csv')
20
- n_inp = len(set(train_csv['label']))
21
- train_csv.head()
22
- def label_func(item):
23
- rel_path = str(item.relative_to('dataset/train'))
24
- return train_csv[train_csv['image_ID']==rel_path]["label"].values[0]
25
-
26
  # %% app.ipynb 5
27
  def classify_image(img):
28
  pred, idx, probs = learn.predict(img)
 
8
  from fastai.vision.all import *
9
  from fastai.data.all import *
10
 
11
+
12
+ def label_func(item):
13
+ rel_path = str(item.relative_to('dataset/train'))
14
+ return train_csv[train_csv['image_ID']==rel_path]["label"].values[0]
15
+
16
  # %% app.ipynb 2
17
  learn = load_learner('model.pkl')
18
 
19
  # %% app.ipynb 3
20
  categories = ('Badminton', 'Cricket', 'Karate', 'Soccer', 'Swimming', 'Tennis', 'Wrestling')
21
 
 
 
 
 
 
 
 
 
 
22
  # %% app.ipynb 5
23
  def classify_image(img):
24
  pred, idx, probs = learn.predict(img)