Fix all file paths for Docker deployment
Browse files- src/streamlit_app.py +2 -2
src/streamlit_app.py
CHANGED
|
@@ -11,7 +11,7 @@ from torchvision.models import resnet18, ResNet18_Weights
|
|
| 11 |
def load_model():
|
| 12 |
model = resnet18(weights=None)
|
| 13 |
model.fc = torch.nn.Linear(512, 2)
|
| 14 |
-
model.load_state_dict(torch.load('src/best_model.pth', map_location='cpu', weights_only=True))
|
| 15 |
model.eval()
|
| 16 |
return model
|
| 17 |
|
|
@@ -32,7 +32,7 @@ def predict(img_path):
|
|
| 32 |
pred = torch.argmax(output, dim=1).item()
|
| 33 |
return "Real" if pred == 1 else "Fake"
|
| 34 |
|
| 35 |
-
directory = "data/sample"
|
| 36 |
if "filename" not in st.session_state:
|
| 37 |
st.session_state.filename = random.choice(os.listdir(directory))
|
| 38 |
|
|
|
|
| 11 |
def load_model():
|
| 12 |
model = resnet18(weights=None)
|
| 13 |
model.fc = torch.nn.Linear(512, 2)
|
| 14 |
+
model.load_state_dict(torch.load('src/src/best_model.pth', map_location='cpu', weights_only=True))
|
| 15 |
model.eval()
|
| 16 |
return model
|
| 17 |
|
|
|
|
| 32 |
pred = torch.argmax(output, dim=1).item()
|
| 33 |
return "Real" if pred == 1 else "Fake"
|
| 34 |
|
| 35 |
+
directory = "src/data/sample"
|
| 36 |
if "filename" not in st.session_state:
|
| 37 |
st.session_state.filename = random.choice(os.listdir(directory))
|
| 38 |
|