Spaces:
Sleeping
Sleeping
Commit
·
511270d
1
Parent(s):
6a9cdf6
adding label func
Browse files
app.py
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
3 |
|
4 |
-
def
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
learn = load_learner("model.pkl")
|
7 |
|
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
3 |
|
4 |
+
def label_func(fname):
|
5 |
+
pattern = r'(FRESH|HALF-FRESH|SPOILED)-\d+-'
|
6 |
+
match = re.search(pattern, fname.name)
|
7 |
+
if match:
|
8 |
+
label = match.group(1)
|
9 |
+
return label
|
10 |
|
11 |
learn = load_learner("model.pkl")
|
12 |
|