lombardata
commited on
Commit
•
7092e6d
1
Parent(s):
fae65ac
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
-
import tensorflow as tf
|
2 |
-
from tensorflow import keras
|
3 |
import numpy as np
|
4 |
import gradio as gr
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Load PyTorch model
|
7 |
def create_head(num_features , number_classes ,dropout_prob=0.5 ,activation_func =nn.ReLU):
|
@@ -14,7 +16,6 @@ def create_head(num_features , number_classes ,dropout_prob=0.5 ,activation_func
|
|
14 |
if dropout_prob !=0 : layers.append(nn.Dropout(dropout_prob))
|
15 |
layers.append(nn.Linear(features_lst[-1] , number_classes))
|
16 |
return nn.Sequential(*layers)
|
17 |
-
from transformers import Dinov2Config, Dinov2Model
|
18 |
|
19 |
class NewheadDinov2ForImageClassification(Dinov2ForImageClassification):
|
20 |
def __init__(self, config: Dinov2Config) -> None:
|
|
|
|
|
|
|
1 |
import numpy as np
|
2 |
import gradio as gr
|
3 |
+
# teo
|
4 |
+
from transformers import Dinov2Config, Dinov2Model, Dinov2ForImageClassification, AutoImageProcessor
|
5 |
+
import torch.nn as nn
|
6 |
+
import os
|
7 |
|
8 |
# Load PyTorch model
|
9 |
def create_head(num_features , number_classes ,dropout_prob=0.5 ,activation_func =nn.ReLU):
|
|
|
16 |
if dropout_prob !=0 : layers.append(nn.Dropout(dropout_prob))
|
17 |
layers.append(nn.Linear(features_lst[-1] , number_classes))
|
18 |
return nn.Sequential(*layers)
|
|
|
19 |
|
20 |
class NewheadDinov2ForImageClassification(Dinov2ForImageClassification):
|
21 |
def __init__(self, config: Dinov2Config) -> None:
|