Farhan1572 commited on
Commit
46d3cd8
·
verified ·
1 Parent(s): 76bc55f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +71 -0
app.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import math
3
+
4
+ # Streamlit App
5
+ st.set_page_config(page_title="OZ Cash and Gold Calculator", layout="wide")
6
+ st.title("OZ Cash to Gold and Gold to OZ Cash Calculator")
7
+
8
+ # --- Section 1: OZ CASH TO GOLD ---
9
+ st.subheader("1. OZ Cash to Gold")
10
+
11
+ # Input Fields
12
+ oz_cash = st.number_input("OZ Cash", min_value=0, value=1280000, step=10000)
13
+ tendon_price = st.number_input("Tendon Price", min_value=0, value=3760, step=10)
14
+ eye_price = st.number_input("Eye Price", min_value=0, value=27500, step=1000)
15
+
16
+ # Calculations
17
+ num_tendons = math.floor(oz_cash / 120)
18
+ num_eyes = math.floor(oz_cash / 900)
19
+ oz_gold_value_tendon = tendon_price * num_tendons
20
+ oz_gold_value_eye = eye_price * num_eyes
21
+ php_value = (oz_cash / 120000) * 5000
22
+
23
+ # Results
24
+ st.write("### Choose One to Sell")
25
+ col1, col2, col3 = st.columns(3)
26
+
27
+ with col1:
28
+ st.metric("# of Tendons", num_tendons)
29
+ st.metric("# of Eyes", num_eyes)
30
+
31
+ with col2:
32
+ st.metric("OZ Gold Value (Tendons)", oz_gold_value_tendon)
33
+ st.metric("OZ Gold Value (Eyes)", oz_gold_value_eye)
34
+
35
+ with col3:
36
+ st.metric("PHP Value", f"{php_value:.2f}")
37
+
38
+
39
+ # --- Section 2: GOLD TO OZ CASH ---
40
+ st.subheader("2. Gold to OZ Cash")
41
+
42
+ # Input Fields
43
+ gold_needed = st.number_input("Gold Needed", min_value=0, value=3500000, step=10000)
44
+ tendon_price_2 = st.number_input("Tendon Price (Gold to Cash)", min_value=0, value=3760, step=10)
45
+ eye_price_2 = st.number_input("Eye Price (Gold to Cash)", min_value=0, value=27350, step=1000)
46
+
47
+ # Calculations
48
+ num_tendons_gold = math.floor(gold_needed / tendon_price_2)
49
+ num_eyes_gold = math.floor(gold_needed / eye_price_2)
50
+ oz_cash_value_tendon = 120 * num_tendons_gold
51
+ oz_cash_value_eye = 900 * num_eyes_gold
52
+ php_value_tendon = (oz_cash_value_tendon / 120000) * 5000
53
+ php_value_eye = (oz_cash_value_eye / 120000) * 5000
54
+
55
+ # Results
56
+ st.write("### Choose One to Sell")
57
+ col4, col5, col6 = st.columns(3)
58
+
59
+ with col4:
60
+ st.metric("# of Tendons", num_tendons_gold)
61
+ st.metric("# of Eyes", num_eyes_gold)
62
+
63
+ with col5:
64
+ st.metric("OZ Cash Value (Tendons)", oz_cash_value_tendon)
65
+ st.metric("OZ Cash Value (Eyes)", oz_cash_value_eye)
66
+
67
+ with col6:
68
+ st.metric("PHP Value (Tendons)", f"{php_value_tendon:.2f}")
69
+ st.metric("PHP Value (Eyes)", f"{php_value_eye:.2f}")
70
+
71
+