Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import torch
|
2 |
from transformers import AutoModel
|
|
|
3 |
from PIL import Image
|
4 |
import numpy as np
|
5 |
import streamlit as st
|
@@ -30,6 +31,7 @@ if uploaded_file is not None:
|
|
30 |
predictions = model(new_image)
|
31 |
logits = predictions.last_hidden_state
|
32 |
logits = logits.view(logits.shape[0], -1)
|
|
|
33 |
feature_reducer = nn.Linear(logits.shape[1], num_classes)
|
34 |
|
35 |
logits = logits.to(device)
|
|
|
1 |
import torch
|
2 |
from transformers import AutoModel
|
3 |
+
import torch.nn as nn
|
4 |
from PIL import Image
|
5 |
import numpy as np
|
6 |
import streamlit as st
|
|
|
31 |
predictions = model(new_image)
|
32 |
logits = predictions.last_hidden_state
|
33 |
logits = logits.view(logits.shape[0], -1)
|
34 |
+
num_classes=2
|
35 |
feature_reducer = nn.Linear(logits.shape[1], num_classes)
|
36 |
|
37 |
logits = logits.to(device)
|