Spaces:
Sleeping
Sleeping
nazlicanto
commited on
Commit
•
e6b5986
1
Parent(s):
4446708
error handling
Browse files
app06.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
|
2 |
import streamlit as st
|
3 |
from transformers import SegformerForSemanticSegmentation, SegformerImageProcessor
|
@@ -6,12 +7,9 @@ import numpy as np
|
|
6 |
import torch
|
7 |
|
8 |
# Load the model and processor
|
9 |
-
|
10 |
-
model = SegformerForSemanticSegmentation.from_pretrained(model_path)
|
11 |
-
preprocessor = SegformerImageProcessor.from_pretrained(model_path)
|
12 |
-
|
13 |
-
model = SegformerForSemanticSegmentation.from_pretrained(model_dir)
|
14 |
-
processor = SegformerImageProcessor.from_pretrained(model_dir)
|
15 |
model.eval()
|
16 |
|
17 |
st.title("PCB Defect Detection")
|
|
|
1 |
+
%%writefile app06_.py
|
2 |
|
3 |
import streamlit as st
|
4 |
from transformers import SegformerForSemanticSegmentation, SegformerImageProcessor
|
|
|
7 |
import torch
|
8 |
|
9 |
# Load the model and processor
|
10 |
+
model_path = "/home/user/app/defectdetection/model"
|
11 |
+
model = SegformerForSemanticSegmentation.from_pretrained(model_path, local_files_only=True)
|
12 |
+
preprocessor = SegformerImageProcessor.from_pretrained(model_path, local_files_only=True)
|
|
|
|
|
|
|
13 |
model.eval()
|
14 |
|
15 |
st.title("PCB Defect Detection")
|