Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,51 +1,80 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import time
|
| 3 |
|
| 4 |
DISCLAIMER = """
|
| 5 |
-
⚠️ PFI
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
This system does NOT provide financial advice.
|
| 9 |
-
Responses are non-executive, exploratory, and informational.
|
| 10 |
"""
|
| 11 |
|
| 12 |
-
def
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
|
|
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
"""
|
| 32 |
|
| 33 |
-
with gr.Blocks() as demo:
|
| 34 |
-
gr.Markdown("
|
| 35 |
-
gr.Markdown("
|
| 36 |
gr.Markdown(DISCLAIMER)
|
| 37 |
|
| 38 |
-
|
| 39 |
-
label="
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
-
submit.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
DISCLAIMER = """
|
| 4 |
+
⚠️ PFI does NOT provide financial advice.
|
| 5 |
+
Responses are non-executive, exploratory, and informational only.
|
|
|
|
|
|
|
|
|
|
| 6 |
"""
|
| 7 |
|
| 8 |
+
def pfi_reasoning(
|
| 9 |
+
goal,
|
| 10 |
+
timeframe,
|
| 11 |
+
income,
|
| 12 |
+
expenses,
|
| 13 |
+
stress,
|
| 14 |
+
blocker,
|
| 15 |
+
discipline
|
| 16 |
+
):
|
| 17 |
+
if not goal or not timeframe:
|
| 18 |
+
return "Please complete all required fields."
|
| 19 |
|
| 20 |
+
return f"""
|
| 21 |
+
🧠 PFI — Financial Cognition Output
|
| 22 |
|
| 23 |
+
GOAL:
|
| 24 |
+
{goal}
|
| 25 |
|
| 26 |
+
TIMEFRAME:
|
| 27 |
+
{timeframe}
|
| 28 |
+
|
| 29 |
+
REALITY SNAPSHOT:
|
| 30 |
+
- Income: {income}
|
| 31 |
+
- Major expenses: {expenses}
|
| 32 |
+
- Current stressor: {stress}
|
| 33 |
+
|
| 34 |
+
BEHAVIORAL BLOCKER:
|
| 35 |
+
{blocker}
|
| 36 |
|
| 37 |
+
DISCIPLINE LEVEL:
|
| 38 |
+
{discipline}/5
|
| 39 |
|
| 40 |
+
---
|
| 41 |
+
PFI INSIGHT:
|
| 42 |
+
Your goal is not limited by numbers, but by behavioral consistency.
|
| 43 |
+
Your primary task is to reduce decision noise and protect focus.
|
| 44 |
|
| 45 |
+
NEXT 30 DAYS:
|
| 46 |
+
- Remove one recurring expense
|
| 47 |
+
- Freeze non-essential decisions
|
| 48 |
+
- Track discipline, not money
|
| 49 |
+
|
| 50 |
+
TRAINING SIGNAL:
|
| 51 |
+
Financial clarity is a *skill*, not a feeling.
|
| 52 |
+
|
| 53 |
+
{DISCLAIMER}
|
| 54 |
"""
|
| 55 |
|
| 56 |
+
with gr.Blocks(theme=gr.themes.Base()) as demo:
|
| 57 |
+
gr.Markdown("# 🧠 PFI | Life")
|
| 58 |
+
gr.Markdown("High-density financial cognition. Intentionally constrained.")
|
| 59 |
gr.Markdown(DISCLAIMER)
|
| 60 |
|
| 61 |
+
with gr.Group():
|
| 62 |
+
goal = gr.Textbox(label="🎯 Financial Goal", placeholder="What do you want to achieve?")
|
| 63 |
+
timeframe = gr.Textbox(label="⏱ Timeframe", placeholder="By when?")
|
| 64 |
+
income = gr.Textbox(label="💸 Monthly Income")
|
| 65 |
+
expenses = gr.Textbox(label="🔻 Main Expenses")
|
| 66 |
+
stress = gr.Textbox(label="⚠️ Biggest Financial Stress")
|
| 67 |
+
blocker = gr.Textbox(label="🧠 Behavioral Blocker")
|
| 68 |
+
discipline = gr.Slider(1, 5, step=1, label="🔁 Discipline Level")
|
| 69 |
|
| 70 |
+
submit = gr.Button("Request PFI Reasoning")
|
| 71 |
|
| 72 |
+
output = gr.Textbox(label="PFI Output", lines=18)
|
| 73 |
|
| 74 |
+
submit.click(
|
| 75 |
+
pfi_reasoning,
|
| 76 |
+
inputs=[goal, timeframe, income, expenses, stress, blocker, discipline],
|
| 77 |
+
outputs=output
|
| 78 |
+
)
|
| 79 |
|
| 80 |
demo.launch()
|