Spaces:
Sleeping
Sleeping
imports
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import gradio as gr
|
|
| 7 |
import albumentations as A
|
| 8 |
from albumentations.pytorch import ToTensorV2
|
| 9 |
from PIL import Image
|
| 10 |
-
|
| 11 |
|
| 12 |
# preprocessing
|
| 13 |
transforms = A.Compose([
|
|
@@ -22,12 +22,11 @@ transforms = A.Compose([
|
|
| 22 |
class PrHu_model(nn.Module):
|
| 23 |
def __init__(self):
|
| 24 |
super().__init__()
|
| 25 |
-
self.configuration =
|
| 26 |
depths=[2, 2, 6, 2], hidden_sizes=[16, 32, 64, 128])
|
| 27 |
-
self.model =
|
| 28 |
|
| 29 |
def forward(self, x):
|
| 30 |
-
# print ('starting model F pass')
|
| 31 |
return self.model(x).logits
|
| 32 |
|
| 33 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
|
|
| 7 |
import albumentations as A
|
| 8 |
from albumentations.pytorch import ToTensorV2
|
| 9 |
from PIL import Image
|
| 10 |
+
from transformers import ConvNextV2Config, ConvNextV2ForImageClassification
|
| 11 |
|
| 12 |
# preprocessing
|
| 13 |
transforms = A.Compose([
|
|
|
|
| 22 |
class PrHu_model(nn.Module):
|
| 23 |
def __init__(self):
|
| 24 |
super().__init__()
|
| 25 |
+
self.configuration = ConvNextV2Config(num_channels=1, drop_path_rate=0, image_size=384, num_labels=1,
|
| 26 |
depths=[2, 2, 6, 2], hidden_sizes=[16, 32, 64, 128])
|
| 27 |
+
self.model = ConvNextV2ForImageClassification(self.configuration)
|
| 28 |
|
| 29 |
def forward(self, x):
|
|
|
|
| 30 |
return self.model(x).logits
|
| 31 |
|
| 32 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|