vishalkatheriya18 commited on
Commit
56dafcf
1 Parent(s): a66e03f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -31,8 +31,20 @@ def find_category(subcategory):
31
 
32
  # Load models and processor only once using Streamlit session state
33
  if 'models_loaded' not in st.session_state:
 
34
  st.session_state.segment_model = YOLO("best.pt")
35
- st.write("Model loaded!")
 
 
 
 
 
 
 
 
 
 
 
36
  st.session_state.models_loaded = True
37
 
38
  # Streamlit app UI
@@ -82,7 +94,7 @@ if url:
82
  # Crop the image based on the bounding box
83
  cropped_image = image_np[y1:y2, x1:x2].copy()
84
  cropped_image = cv2.resize(cropped_image, (200, 200)) # Resize cropped image
85
- category_name = find_category(class_label)
86
 
87
  # Add cropped image and its title to the list
88
  cropped_images.append((cropped_image, f'Class: {category_name}, Confidence: {confidence:.2f}'))
 
31
 
32
  # Load models and processor only once using Streamlit session state
33
  if 'models_loaded' not in st.session_state:
34
+ #localization model
35
  st.session_state.segment_model = YOLO("best.pt")
36
+ #image preprocessor
37
+ st.session_state.image_processor = AutoImageProcessor.from_pretrained("vishalkatheriya18/convnextv2-tiny-1k-224-finetuned-topwear")
38
+ #top wear
39
+ st.session_state.top_wear_model = AutoModelForImageClassification.from_pretrained("vishalkatheriya18/convnextv2-tiny-1k-224-finetuned-topwear")
40
+ #bootomwear
41
+ st.session_state.bottomwear_model = AutoModelForImageClassification.from_pretrained("vishalkatheriya18/convnextv2-tiny-1k-224-finetuned-bottomwear")
42
+ #fullwear
43
+ st.session_state.fullwear = AutoModelForImageClassification.from_pretrained("vishalkatheriya18/convnextv2-tiny-1k-224-finetuned-fullwear")
44
+ #for fullwear and top wear
45
+ st.session_state.pattern_model = AutoModelForImageClassification.from_pretrained("vishalkatheriya18/convnextv2-tiny-1k-224-finetuned-pattern-rgb")
46
+ st.session_state.print_model = AutoModelForImageClassification.from_pretrained("vishalkatheriya18/convnextv2-tiny-1k-224-finetuned-print")
47
+ st.session_state.sleeve_length_model = AutoModelForImageClassification.from_pretrained("vishalkatheriya18/convnextv2-tiny-1k-224-finetuned-sleeve-length")
48
  st.session_state.models_loaded = True
49
 
50
  # Streamlit app UI
 
94
  # Crop the image based on the bounding box
95
  cropped_image = image_np[y1:y2, x1:x2].copy()
96
  cropped_image = cv2.resize(cropped_image, (200, 200)) # Resize cropped image
97
+ category_name = find_category(class_label) #categories name is here...................................
98
 
99
  # Add cropped image and its title to the list
100
  cropped_images.append((cropped_image, f'Class: {category_name}, Confidence: {confidence:.2f}'))