Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -43,13 +43,14 @@ def calculate_power_factor_correction(load_kw, pf_initial, pf_target):
|
|
43 |
|
44 |
plt.tight_layout()
|
45 |
plt.savefig("power_factor_correction.png")
|
|
|
46 |
|
47 |
return (f"Required Capacitor Size: {capacitor_size:.2f} kVAR",
|
48 |
f"Corrected Power Factor: {pf_corrected:.2f}",
|
49 |
-
|
50 |
|
51 |
except Exception as e:
|
52 |
-
return str(e), "",
|
53 |
|
54 |
# Create Gradio interface
|
55 |
def power_factor_correction_ui(load_kw, pf_initial, pf_target):
|
|
|
43 |
|
44 |
plt.tight_layout()
|
45 |
plt.savefig("power_factor_correction.png")
|
46 |
+
plt.close(fig)
|
47 |
|
48 |
return (f"Required Capacitor Size: {capacitor_size:.2f} kVAR",
|
49 |
f"Corrected Power Factor: {pf_corrected:.2f}",
|
50 |
+
"power_factor_correction.png")
|
51 |
|
52 |
except Exception as e:
|
53 |
+
return str(e), "", ""
|
54 |
|
55 |
# Create Gradio interface
|
56 |
def power_factor_correction_ui(load_kw, pf_initial, pf_target):
|