bpmredacademy commited on
Commit
c5cdb34
·
verified ·
1 Parent(s): 7e05845

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -31
app.py CHANGED
@@ -1,51 +1,80 @@
1
  import gradio as gr
2
- import time
3
 
4
  DISCLAIMER = """
5
- ⚠️ PFI Personal Financial Intelligence
6
- Research Preview Only.
7
-
8
- This system does NOT provide financial advice.
9
- Responses are non-executive, exploratory, and informational.
10
  """
11
 
12
- def pfi_response(prompt):
13
- if len(prompt.strip()) < 20:
14
- return "⚠️ Prompt too short. High-density questions only."
 
 
 
 
 
 
 
 
15
 
16
- if len(prompt) > 600:
17
- return "⚠️ Prompt too long. Precision is part of the cost."
18
 
19
- # Intentional latency (signals value)
20
- time.sleep(1.2)
21
 
22
- return f"""
23
- PFI RESPONSE (Preview):
 
 
 
 
 
 
 
 
24
 
25
- Your question indicates a valid financial reasoning pattern.
 
26
 
27
- This preview does not execute decisions.
28
- For licensed access, contact BPM RED Academy.
 
 
29
 
30
- PFI Core
 
 
 
 
 
 
 
 
31
  """
32
 
33
- with gr.Blocks() as demo:
34
- gr.Markdown("## 🧠 Personal Financial Intelligence (PFI)")
35
- gr.Markdown("**High-density financial reasoning. Intentionally constrained.**")
36
  gr.Markdown(DISCLAIMER)
37
 
38
- prompt = gr.Textbox(
39
- label="Your Question",
40
- placeholder="Formulate a precise, high-impact financial question...",
41
- lines=4,
42
- max_lines=6
43
- )
 
 
44
 
45
- output = gr.Textbox(label="PFI Output", lines=8)
46
 
47
- submit = gr.Button("Request Reasoning")
48
 
49
- submit.click(fn=pfi_response, inputs=prompt, outputs=output)
 
 
 
 
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()