Spaces:
No application file
No application file
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,56 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
|
| 3 |
-
balance = 10000.00
|
| 4 |
-
transactions = [
|
| 5 |
-
"Received ₱2,000 from Maria",
|
| 6 |
-
"Paid ₱500 for Mobile Load",
|
| 7 |
-
]
|
| 8 |
-
|
| 9 |
-
def get_balance():
|
| 10 |
-
return f"₱{balance:,.2f}"
|
| 11 |
-
|
| 12 |
-
def send_money(name, amount):
|
| 13 |
-
global balance
|
| 14 |
-
try:
|
| 15 |
-
amount = float(amount)
|
| 16 |
-
except:
|
| 17 |
-
return get_balance(), "Enter a valid amount."
|
| 18 |
-
|
| 19 |
-
if amount <= 0:
|
| 20 |
-
return get_balance(), "Amount must be greater than zero."
|
| 21 |
-
|
| 22 |
-
if amount > balance:
|
| 23 |
-
return get_balance(), "Insufficient balance."
|
| 24 |
-
|
| 25 |
-
balance -= amount
|
| 26 |
-
transactions.insert(0, f"Sent ₱{amount:,.2f} to {name}")
|
| 27 |
-
|
| 28 |
-
return get_balance(), "\n".join(transactions)
|
| 29 |
-
|
| 30 |
-
with gr.Blocks(title="Wallet Demo") as demo:
|
| 31 |
-
gr.Markdown("# Wallet Demo")
|
| 32 |
-
gr.Markdown("Educational demo with fictional data only.")
|
| 33 |
-
|
| 34 |
-
balance_box = gr.Textbox(
|
| 35 |
-
value=get_balance(),
|
| 36 |
-
label="Current Balance"
|
| 37 |
-
)
|
| 38 |
-
|
| 39 |
-
recipient = gr.Textbox(label="Recipient")
|
| 40 |
-
amount = gr.Number(label="Amount (PHP)")
|
| 41 |
-
|
| 42 |
-
send_btn = gr.Button("Send Money")
|
| 43 |
-
|
| 44 |
-
history = gr.Textbox(
|
| 45 |
-
value="\n".join(transactions),
|
| 46 |
-
lines=10,
|
| 47 |
-
label="Transaction History"
|
| 48 |
-
)
|
| 49 |
-
|
| 50 |
-
send_btn.click(
|
| 51 |
-
send_money,
|
| 52 |
-
inputs=[recipient, amount],
|
| 53 |
-
outputs=[balance_box, history]
|
| 54 |
-
)
|
| 55 |
-
|
| 56 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|