Sanjayraju30 commited on
Commit
4b09964
·
verified ·
1 Parent(s): ddac357

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -0
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import dash
2
+ from dash import dcc, html
3
+ import plotly.express as px
4
+ import pandas as pd
5
+ import numpy as np
6
+
7
+ # Define sites and poles
8
+ sites = ['Hyderabad', 'Karnrol', 'Bangalore', 'Ongol']
9
+ num_poles_per_site = 12
10
+
11
+ # Generate random data
12
+ data = []
13
+ for site in sites:
14
+ for pole_id in range(1, num_poles_per_site + 1):
15
+ data.append({
16
+ 'Site': site,
17
+ 'Pole ID': f'Pole {pole_id}',
18
+ 'Status': np.random.randint(0, 100) # Simulated metric
19
+ })
20
+
21
+ df = pd.DataFrame(data)
22
+
23
+ # Pivot for heatmap
24
+ heatmap_data = df.pivot(index='Site', columns='Pole ID', values='Status')
25
+
26
+ # Create heatmap
27
+ fig = px.imshow(
28
+ heatmap_data,
29
+ labels=dict(x="Pole ID", y="Site", color="Status"),
30
+ color_continuous_scale="Viridis"
31
+ )
32
+
33
+ # Dash App
34
+ app = dash.Dash(__name__)
35
+ app.title = "Pole Management Heatmap"
36
+
37
+ app.layout = html.Div([
38
+ html.H1("Pole Management Heatmap", style={'textAlign': 'center'}),
39
+ dcc.Graph(figure=fig)
40
+ ])
41
+
42
+ if __name__ == '__main__':
43
+ app.run_server(debug=True, host='0.0.0.0', port=7860)