Du Mingzhe commited on
Commit
0b4b1f8
1 Parent(s): 6fa9c13
Files changed (1) hide show
  1. app.py +18 -8
app.py CHANGED
@@ -3,6 +3,8 @@ import streamlit as st
3
 
4
  st.title("GCP Resource Alloctor")
5
 
 
 
6
  # GPU Type
7
  gpu_type = st.selectbox(
8
  'GPU Type',
@@ -74,7 +76,10 @@ else:
74
  balanced_disk_size = st.select_slider('Balanced Disk (GB)', [i for i in range(10, 65536, 10)])
75
 
76
  # SSD Disk
77
- ssd_disk_size = st.select_slider('SSD Disk (GB)', [i * 375 for i in [1,2,3,4,5,6,7,8,16,24]])
 
 
 
78
 
79
  # Pricing Estimate
80
  serivces_mapping = {
@@ -111,11 +116,16 @@ memory_price = serivces_mapping['RAM'][instance_type] * memory_size
111
  gpu_price = serivces_mapping['GPU'][gpu_type] * gpu_number
112
  balanced_disk_price = serivces_mapping['PD'] * balanced_disk_size
113
  ssd_disk_price = serivces_mapping['SSD'] * ssd_disk_size
114
- total_price = core_price + memory_price + gpu_price + balanced_disk_price + ssd_disk_price
 
 
 
115
 
116
- st.write(core_price)
117
- st.write(memory_price)
118
- st.write(gpu_price)
119
- st.write(balanced_disk_price)
120
- st.write(ssd_disk_price)
121
- st.write(total_price)
 
 
 
3
 
4
  st.title("GCP Resource Alloctor")
5
 
6
+ st.subheader("Configuration")
7
+
8
  # GPU Type
9
  gpu_type = st.selectbox(
10
  'GPU Type',
 
76
  balanced_disk_size = st.select_slider('Balanced Disk (GB)', [i for i in range(10, 65536, 10)])
77
 
78
  # SSD Disk
79
+ ssd_disk_size = st.select_slider('SSD Disk (GB)', [i * 375 for i in [0,1,2,3,4,5,6,7,8,16,24]])
80
+
81
+ # Hours
82
+ hours = st.select_slider('Duration (Hours)', [i for i in range(1, 168)])
83
 
84
  # Pricing Estimate
85
  serivces_mapping = {
 
116
  gpu_price = serivces_mapping['GPU'][gpu_type] * gpu_number
117
  balanced_disk_price = serivces_mapping['PD'] * balanced_disk_size
118
  ssd_disk_price = serivces_mapping['SSD'] * ssd_disk_size
119
+ duration_total_price = core_price + memory_price + gpu_price + balanced_disk_price + ssd_disk_price
120
+ total_price = duration_total_price * hours
121
+
122
+ st.divider()
123
 
124
+ st.subheader("Hourly estimate")
125
+ st.write(f"Core: SGD :blue[{core_price}]")
126
+ st.write(f"Memory: SGD :blue[{memory_price}]")
127
+ st.write(f"GPU: SGD :blue[{gpu_price}]")
128
+ st.write(f"Balance Disk: SGD :blue[{balanced_disk_price}]")
129
+ st.write(f"SSD Disk: SGD :blue[{ssd_disk_price}]")
130
+ st.write(f"Hourly Total: SGD :blue[{total_price}]")
131
+ st.write(f"Duration Total: SGD :blue[{total_price}]")