Spaces:
Build error
Build error
COULIBALY BOURAHIMA commited on
Commit ·
c4c2d8b
1
Parent(s): 785c15d
gestion des exceptions
Browse files
App/class_input_box/input_box.py
CHANGED
|
@@ -10,21 +10,18 @@ class InputsBox:
|
|
| 10 |
self.product_id = None
|
| 11 |
self.class_id = None
|
| 12 |
|
| 13 |
-
def get_data(self)
|
| 14 |
uploaded_file = st.file_uploader("Choose a CSV file with the separator ';' ", type=["csv"])
|
| 15 |
|
| 16 |
if uploaded_file is not None:
|
| 17 |
-
try:
|
| 18 |
self.data = pd.read_csv(uploaded_file,dtype=str, sep=";")
|
| 19 |
-
|
| 20 |
-
except:
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
self.columns = self.data.columns.tolist()
|
| 26 |
-
|
| 27 |
-
return self.data
|
| 28 |
|
| 29 |
def valid_produict_id(self) -> int:
|
| 30 |
min_len = st.number_input("Minimum len of product_id", max_value= 25, min_value=1, value= 2, key = "pp")
|
|
|
|
| 10 |
self.product_id = None
|
| 11 |
self.class_id = None
|
| 12 |
|
| 13 |
+
def get_data(self) :
|
| 14 |
uploaded_file = st.file_uploader("Choose a CSV file with the separator ';' ", type=["csv"])
|
| 15 |
|
| 16 |
if uploaded_file is not None:
|
| 17 |
+
try :
|
| 18 |
self.data = pd.read_csv(uploaded_file,dtype=str, sep=";")
|
| 19 |
+
|
| 20 |
+
except :
|
| 21 |
+
self.data = pd.read_csv(uploaded_file,dtype=str, sep=";" , encoding="latin-1")
|
| 22 |
+
|
| 23 |
+
self.columns = self.data.columns.tolist()
|
| 24 |
+
return self.data
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
def valid_produict_id(self) -> int:
|
| 27 |
min_len = st.number_input("Minimum len of product_id", max_value= 25, min_value=1, value= 2, key = "pp")
|