khan994 commited on
Commit
bf17d6c
·
1 Parent(s): 64bd6a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -1,6 +1,22 @@
1
  from fastai.vision.all import *
2
  import gradio as gr
3
  import glob
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  #class Hook():
6
  # def hook_func(self, m, i, o): self.stored = o.detach().clone()
 
1
  from fastai.vision.all import *
2
  import gradio as gr
3
  import glob
4
+ import timm
5
+ from timm.models import convnext
6
+ convnext_model = 'convnext_tiny_in22k'
7
+ model_architecture=timm.create_model(convnext_model)
8
+
9
+ import torch
10
+ class FastaiConvNext(torch.nn.Module):
11
+ def __init__(self, original_model):
12
+ super().__init__()
13
+ self.features = original_model
14
+
15
+ def forward(self, x):
16
+ x = self.features(x)
17
+ return x
18
+
19
+ model = FastaiConvNext(model_architecture)
20
 
21
  #class Hook():
22
  # def hook_func(self, m, i, o): self.stored = o.detach().clone()