Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,13 +11,18 @@ from langchain.memory import ConversationBufferMemory
|
|
| 11 |
import torch
|
| 12 |
from PIL import Image
|
| 13 |
from torchvision import transforms, models
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
class GeometryImageClassifier:
|
| 16 |
def __init__(self):
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
self.transform = transforms.Compose([
|
| 23 |
transforms.Resize((224, 224)),
|
|
|
|
| 11 |
import torch
|
| 12 |
from PIL import Image
|
| 13 |
from torchvision import transforms, models
|
| 14 |
+
from langchain_community.llms import HuggingFaceEndpoint
|
| 15 |
+
from langchain_huggingface import HuggingFaceEmbeddings
|
| 16 |
+
from torchvision import transforms, models
|
| 17 |
|
| 18 |
class GeometryImageClassifier:
|
| 19 |
def __init__(self):
|
| 20 |
+
def __init__(self):
|
| 21 |
+
# Change this line
|
| 22 |
+
self.model = models.resnet18(weights=models.ResNet18_Weights.DEFAULT) # Updated syntax
|
| 23 |
+
self.model.fc = torch.nn.Identity()
|
| 24 |
+
self.model = self.model.to('cpu')
|
| 25 |
+
self.model.eval()
|
| 26 |
|
| 27 |
self.transform = transforms.Compose([
|
| 28 |
transforms.Resize((224, 224)),
|