razaali10 commited on
Commit
629824c
·
verified ·
1 Parent(s): 4a58dd2

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +27 -0
  2. app.py +28 -0
  3. requirements.txt +4 -0
README.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: EPANET Simulation API
3
+ emoji: 💧
4
+ colorFrom: blue
5
+ colorTo: indigo
6
+ sdk: streamlit
7
+ sdk_version: "1.32.2"
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ # 💧 EPANET Simulation API using WNTR
13
+
14
+ This Hugging Face Space hosts a web-based EPANET simulation interface using the **Water Network Tool for Resilience (WNTR)** and **Streamlit**. It enables users to upload `.inp` files, configure simulation parameters, and generate hydraulic analysis results including pressure and flow data.
15
+
16
+ ...
17
+
18
+ ## 📬 Contact
19
+
20
+ For bug reports, feature requests, or professional support, contact:
21
+
22
+ **Raza Ali, P.Eng.**
23
+ Civil Engineer, Ontario
24
+ Email: *[your email]*
25
+ Hugging Face: [@razaali10](https://huggingface.co/razaali10)
26
+
27
+ ---
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import wntr
3
+ import tempfile
4
+ import os
5
+ import pandas as pd
6
+ import matplotlib.pyplot as plt
7
+
8
+ st.set_page_config(page_title="EPANET Simulation API", layout="wide")
9
+ st.title("💧 EPANET Simulation with WNTR")
10
+
11
+ uploaded_file = st.file_uploader("Upload your EPANET .inp file", type=["inp"])
12
+ if uploaded_file:
13
+ with tempfile.NamedTemporaryFile(delete=False, suffix=".inp") as temp:
14
+ temp.write(uploaded_file.read())
15
+ inp_path = temp.name
16
+
17
+ st.success("File uploaded. Starting simulation...")
18
+
19
+ wn = wntr.network.WaterNetworkModel(inp_path)
20
+ sim = wntr.sim.EpanetSimulator(wn)
21
+ results = sim.run_sim()
22
+
23
+ st.subheader("Simulation Complete")
24
+ pressure = results.node["pressure"]
25
+ st.line_chart(pressure)
26
+
27
+ st.download_button("Download Pressure Data (CSV)", data=pressure.to_csv().encode('utf-8'),
28
+ file_name="pressure_results.csv", mime="text/csv")
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ streamlit
2
+ wntr
3
+ matplotlib
4
+ pandas