Commit
·
7cca923
1
Parent(s):
e93f5fc
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,23 @@ import torch
|
|
4 |
import timm
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
|
|
|
|
7 |
|
8 |
device = torch.device('cpu')
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
labels = {0: 'bacterial_leaf_blight',
|
11 |
1: 'bacterial_leaf_streak',
|
12 |
2: 'bacterial_panicle_blight',
|
|
|
4 |
import timm
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
7 |
+
import os
|
8 |
+
import random
|
9 |
|
10 |
device = torch.device('cpu')
|
11 |
|
12 |
+
def seed_everything(seed=42):
|
13 |
+
random.seed(seed)
|
14 |
+
os.environ['PYTHONHASHSEED'] = str(seed)
|
15 |
+
np.random.seed(seed)
|
16 |
+
torch.manual_seed(seed)
|
17 |
+
torch.cuda.manual_seed(seed)
|
18 |
+
torch.backends.cudnn.deterministic = True
|
19 |
+
torch.backends.cudnn.benchmark = True
|
20 |
+
|
21 |
+
seed_everything(seed=42)
|
22 |
+
|
23 |
+
|
24 |
labels = {0: 'bacterial_leaf_blight',
|
25 |
1: 'bacterial_leaf_streak',
|
26 |
2: 'bacterial_panicle_blight',
|