ccaglieri commited on
Commit
4865409
·
1 Parent(s): b2b6333

Create new file

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+ import numpy as np
4
+ from torchvision import models, transforms
5
+ import time
6
+ import os
7
+ import copy
8
+ import pickle
9
+ from PIL import Image
10
+ import datetime
11
+ import gdown
12
+ import urllib.request
13
+ import gradio as gr
14
+
15
+ url = 'https://drive.google.com/file/d/1GGnkicLQwgcgLq6sWClC_Igi8PWFQyV1'
16
+ #path_class_names = "./class_names_restnet_catsVSdogs.pkl"
17
+ gdown.download(url, path_class_names, quiet=False, use_cookies=False)
18
+
19
+ # Parameters
20
+ DATASET_PATH = '/content/APTOS2019'
21
+ PREP_PATH = DATASET_PATH + "/preprocessed/"
22
+ MODEL_PATH= '/content/APTOS2019/checkpoints/checkpoint_convnext.pth'
23
+
24
+ if not os.path.exists(PREP_PATH):
25
+ os.mkdir(PREP_PATH)
26
+
27
+ if not os.path.exists("/checkpoints"):
28
+ os.mkdir("/checkpoints")
29
+
30
+ def do_inference():
31
+ return 0
32
+
33
+ title = "ConvNeXt for Diabetic Retinopathy Detection"
34
+ description = ""
35
+ #examples = [['./cat.jpg'],['./dog.jpg']]
36
+ #article="<p style='text-align: center'><a href='https://github.com/mawady/colab-recipes-cv' target='_blank'>Colab Recipes for Computer Vision - Dr. Mohamed Elawady</a></p>"
37
+ iface = gr.Interface(
38
+ do_inference,
39
+ title=title,
40
+ description=description,
41
+ )
42
+
43
+ iface.test_launch()
44
+
45
+ #iface.launch()