Spaces:
Sleeping
Sleeping
Update app/main.py
#64
by axelrvite - opened
- app/main.py +4 -6
app/main.py
CHANGED
|
@@ -88,6 +88,10 @@ async def predict(file: UploadFile = File(...)):
|
|
| 88 |
params_mlp, I_mlp = comp_iv_curve(temp_filepath, temperature)
|
| 89 |
# Calcul du SSD pour MLP
|
| 90 |
I_exp = np.array([point[1] for point in exp_points])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
ssd_mlp = np.mean((I_exp - I_mlp) ** 2)
|
| 92 |
|
| 93 |
# Analyse par CNN1D
|
|
@@ -123,8 +127,6 @@ async def predict(file: UploadFile = File(...)):
|
|
| 123 |
|
| 124 |
print("GEN params:", params_genetique)
|
| 125 |
print("RAND params:", params_random)
|
| 126 |
-
print("CNN params:", params_cnn)
|
| 127 |
-
print("MLP params:", params_mlp)
|
| 128 |
params_mlp.pop("nVth", None)
|
| 129 |
params_cnn.pop("nVth", None)
|
| 130 |
print("CNN params:", params_cnn)
|
|
@@ -132,25 +134,21 @@ async def predict(file: UploadFile = File(...)):
|
|
| 132 |
|
| 133 |
try:
|
| 134 |
error_random = get_parameter_error_bounds(I_exp, V_exp, Rs=params_random["Rs"], Rsh=params_random["Rsh"], n=params_random["n"], J0=params_random["J0"], Jph=params_random["Jph"])
|
| 135 |
-
print("Coucou 1")
|
| 136 |
except Exception as e:
|
| 137 |
raise HTTPException(status_code=500, detail=f"Erreur dans Rand : {e}")
|
| 138 |
|
| 139 |
try:
|
| 140 |
error_genetique = get_parameter_error_bounds(I_exp, V_exp, Rs=params_genetique["Rs"], Rsh=params_genetique["Rsh"], n=params_genetique["n"], J0=params_genetique["J0"], Jph=params_genetique["Jph"])
|
| 141 |
-
print("Coucou 2")
|
| 142 |
except Exception as e:
|
| 143 |
raise HTTPException(status_code=500, detail=f"Erreur dans Gen : {e}")
|
| 144 |
|
| 145 |
try:
|
| 146 |
error_cnn = get_parameter_error_bounds(I_exp, V_exp, Rs=params_cnn["Rs"], Rsh=params_cnn["Rsh"], n=params_cnn["n"], J0=params_cnn["J0"], Jph=params_cnn["Jph"])
|
| 147 |
-
print("Coucou 4")
|
| 148 |
except Exception as e:
|
| 149 |
raise HTTPException(status_code=500, detail=f"Erreur dans CNN : {e}")
|
| 150 |
|
| 151 |
try:
|
| 152 |
error_mlp = get_parameter_error_bounds(I_exp, V_exp, Rs=params_mlp["Rs"], Rsh=params_mlp["Rsh"], n=params_mlp["n"], J0=params_mlp["J0"], Jph=params_mlp["Jph"])
|
| 153 |
-
print("Coucou 3")
|
| 154 |
except Exception as e:
|
| 155 |
raise HTTPException(status_code=500, detail=f"Erreur dans MLP : {e}")
|
| 156 |
|
|
|
|
| 88 |
params_mlp, I_mlp = comp_iv_curve(temp_filepath, temperature)
|
| 89 |
# Calcul du SSD pour MLP
|
| 90 |
I_exp = np.array([point[1] for point in exp_points])
|
| 91 |
+
|
| 92 |
+
if I_exp[0]<I_exp[-1]:
|
| 93 |
+
print("retournement")
|
| 94 |
+
I_exp= -I_exp
|
| 95 |
ssd_mlp = np.mean((I_exp - I_mlp) ** 2)
|
| 96 |
|
| 97 |
# Analyse par CNN1D
|
|
|
|
| 127 |
|
| 128 |
print("GEN params:", params_genetique)
|
| 129 |
print("RAND params:", params_random)
|
|
|
|
|
|
|
| 130 |
params_mlp.pop("nVth", None)
|
| 131 |
params_cnn.pop("nVth", None)
|
| 132 |
print("CNN params:", params_cnn)
|
|
|
|
| 134 |
|
| 135 |
try:
|
| 136 |
error_random = get_parameter_error_bounds(I_exp, V_exp, Rs=params_random["Rs"], Rsh=params_random["Rsh"], n=params_random["n"], J0=params_random["J0"], Jph=params_random["Jph"])
|
|
|
|
| 137 |
except Exception as e:
|
| 138 |
raise HTTPException(status_code=500, detail=f"Erreur dans Rand : {e}")
|
| 139 |
|
| 140 |
try:
|
| 141 |
error_genetique = get_parameter_error_bounds(I_exp, V_exp, Rs=params_genetique["Rs"], Rsh=params_genetique["Rsh"], n=params_genetique["n"], J0=params_genetique["J0"], Jph=params_genetique["Jph"])
|
|
|
|
| 142 |
except Exception as e:
|
| 143 |
raise HTTPException(status_code=500, detail=f"Erreur dans Gen : {e}")
|
| 144 |
|
| 145 |
try:
|
| 146 |
error_cnn = get_parameter_error_bounds(I_exp, V_exp, Rs=params_cnn["Rs"], Rsh=params_cnn["Rsh"], n=params_cnn["n"], J0=params_cnn["J0"], Jph=params_cnn["Jph"])
|
|
|
|
| 147 |
except Exception as e:
|
| 148 |
raise HTTPException(status_code=500, detail=f"Erreur dans CNN : {e}")
|
| 149 |
|
| 150 |
try:
|
| 151 |
error_mlp = get_parameter_error_bounds(I_exp, V_exp, Rs=params_mlp["Rs"], Rsh=params_mlp["Rsh"], n=params_mlp["n"], J0=params_mlp["J0"], Jph=params_mlp["Jph"])
|
|
|
|
| 152 |
except Exception as e:
|
| 153 |
raise HTTPException(status_code=500, detail=f"Erreur dans MLP : {e}")
|
| 154 |
|