Spaces:
Sleeping
Sleeping
Dollaya Piumsuwan commited on
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +8 -3
src/streamlit_app.py
CHANGED
|
@@ -11,13 +11,18 @@ import torch.nn as nn
|
|
| 11 |
from PIL import Image
|
| 12 |
import os
|
| 13 |
import io
|
|
|
|
| 14 |
|
| 15 |
#########################
|
| 16 |
# SETTINGS
|
| 17 |
# ########################
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 22 |
class_index = {"Drawing": 0, "Photograph": 1, "Print": 2}
|
| 23 |
|
|
|
|
| 11 |
from PIL import Image
|
| 12 |
import os
|
| 13 |
import io
|
| 14 |
+
from pathlib import Path
|
| 15 |
|
| 16 |
#########################
|
| 17 |
# SETTINGS
|
| 18 |
# ########################
|
| 19 |
+
base_path = Path(__file__).resolve().parent.parent
|
| 20 |
+
model_file = base_path / "models" / "momaclassifier_resnet50.pt"
|
| 21 |
+
image_csv = base_path / "data" / "demo_artworks.csv"
|
| 22 |
+
image_folder = base_path / "demo_images"
|
| 23 |
+
model_file = str(model_file)
|
| 24 |
+
image_csv = str(image_csv)
|
| 25 |
+
image_folder = str(image_folder)
|
| 26 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 27 |
class_index = {"Drawing": 0, "Photograph": 1, "Print": 2}
|
| 28 |
|