bpmredacademy commited on
Commit
8983830
·
verified ·
1 Parent(s): 06ac357

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +72 -50
app.py CHANGED
@@ -1,59 +1,72 @@
1
  import gradio as gr
2
  import textwrap
3
 
4
- # -------------------------------
5
  # Core PFI reasoning stub
6
  # (preview-only, non-executive)
7
- # -------------------------------
 
 
8
 
9
  def pfi_reasoning(question: str) -> str:
10
- if not question or len(question.strip()) < 20:
11
- return (
12
- "Input rejected.\n\n"
13
- "PFI requires a precise, high-density financial question.\n"
14
- "Ambiguous or underspecified inputs reduce analytical value."
15
- )
 
 
 
 
 
 
 
 
16
 
17
  response = f"""
18
- PFI ANALYSIS (PREVIEW)
19
-
20
- Question Structure:
21
- - Topic domain identified
22
- - Scope appears conceptual, not executable
23
- - Time horizon and constraints are partially defined
24
-
25
- Cognitive Decomposition:
26
- - Primary variables detected
27
- - Secondary dependencies inferred
28
- - Risk vectors identified at a structural level
29
-
30
- Reasoning Notes:
31
- - This output is exploratory and non-executive
32
- - No prediction, advice, or action is implied
33
- - Further precision would increase analytical depth
34
-
35
- Next Step (Optional):
36
- - Narrow the scope
37
- - Specify constraints
38
- - Clarify the decision context
39
- """
 
 
 
40
 
41
  return textwrap.dedent(response).strip()
42
 
43
 
44
- # -------------------------------
45
  # Gradio UI
46
- # -------------------------------
47
 
48
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
49
  gr.Markdown(
50
  """
51
- # 🧠 Personal Financial Intelligence (PFI)
52
- **High-density financial reasoning · Research Preview**
53
 
54
- ⚠️ *PFI is a research preview system.
55
- It does NOT provide financial advice or execute decisions.*
56
- """
57
  )
58
 
59
  with gr.Row():
@@ -63,37 +76,46 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
63
  "Formulate one precise, high-impact financial question.\n"
64
  "Ambiguity reduces output quality."
65
  ),
66
- lines=4
67
  )
68
 
69
- analyze_button = gr.Button("Request Analysis (Limited)")
70
 
71
  output_box = gr.Textbox(
72
  label="PFI Output (Exploratory · Non-Executable)",
73
- lines=12
74
  )
75
 
76
  analyze_button.click(
77
  fn=pfi_reasoning,
78
  inputs=question_input,
79
- outputs=output_box
80
  )
81
 
 
82
  gr.Markdown(
83
  """
84
- ---
85
- **Disclaimer**
86
 
87
- PFI outputs are exploratory and informational only.
88
- No financial advice, trading signals, or decision execution is provided.
89
 
90
- © 2026 BPM RED Academy · All rights reserved.
91
- """
92
  )
93
 
94
- # -------------------------------
95
- # Launch
96
- # -------------------------------
 
 
 
 
 
 
 
 
97
 
98
  if __name__ == "__main__":
99
  demo.launch()
 
1
  import gradio as gr
2
  import textwrap
3
 
4
+ # ----------------------------
5
  # Core PFI reasoning stub
6
  # (preview-only, non-executive)
7
+ # ----------------------------
8
+
9
+ MIN_CHARS = 20
10
 
11
  def pfi_reasoning(question: str) -> str:
12
+ if not question or len(question.strip()) < MIN_CHARS:
13
+ return textwrap.dedent(
14
+ """
15
+ [Input rejected]
16
+
17
+ PFI requires a precise, high-density financial question.
18
+ Ambiguous or underspecified inputs reduce analytical value.
19
+
20
+ Tip:
21
+ - Include horizon (e.g., 3–7 years)
22
+ - Include constraints (liquidity, taxes, drawdown limits)
23
+ - Include context (income stability, concentration risk, jurisdiction)
24
+ """
25
+ ).strip()
26
 
27
  response = f"""
28
+ PFI ANALYSIS (PREVIEW)
29
+
30
+ Question (received):
31
+ - {question.strip()}
32
+
33
+ Question Structure:
34
+ - Topic domain identified
35
+ - Scope appears conceptual, not executable
36
+ - Time horizon and constraints are partially defined
37
+
38
+ Cognitive Decomposition:
39
+ - Primary variables detected
40
+ - Secondary dependencies inferred
41
+ - Risk vectors identified at structural level
42
+
43
+ Reasoning Notes:
44
+ - This output is exploratory and non-executive
45
+ - No prediction, advice, or action is implied
46
+ - Further precision would increase analytical depth
47
+
48
+ Next Step (Optional):
49
+ - Narrow the scope
50
+ - Specify constraints
51
+ - Clarify the decision context
52
+ """
53
 
54
  return textwrap.dedent(response).strip()
55
 
56
 
57
+ # ----------------------------
58
  # Gradio UI
59
+ # ----------------------------
60
 
61
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
62
  gr.Markdown(
63
  """
64
+ # 🧠 Personal Financial Intelligence (PFI)
65
+ **High-density financial reasoning · Research Preview**
66
 
67
+ ⚠️ *PFI is a research preview system.
68
+ It does NOT provide financial advice or execute decisions.*
69
+ """
70
  )
71
 
72
  with gr.Row():
 
76
  "Formulate one precise, high-impact financial question.\n"
77
  "Ambiguity reduces output quality."
78
  ),
79
+ lines=4,
80
  )
81
 
82
+ analyze_button = gr.Button("Request Structural Analysis (Preview)")
83
 
84
  output_box = gr.Textbox(
85
  label="PFI Output (Exploratory · Non-Executable)",
86
+ lines=10, # (C) premium feel: tighter box
87
  )
88
 
89
  analyze_button.click(
90
  fn=pfi_reasoning,
91
  inputs=question_input,
92
+ outputs=output_box,
93
  )
94
 
95
+ # (B) Locked section
96
  gr.Markdown(
97
  """
98
+ ---
99
+ 🔒 **Deeper Structural Reasoning — Locked**
100
 
101
+ Personalized constraints, scenario trade-offs, and capital structure reasoning
102
+ are available only under **PFI Licensed Access**.
103
 
104
+ 👉 *Request access:* **pfi@bpmred.academy**
105
+ """
106
  )
107
 
108
+ # Footer disclaimer
109
+ gr.Markdown(
110
+ """
111
+ ---
112
+ ### Disclaimer
113
+ PFI outputs are exploratory and informational only.
114
+ No financial advice, trading signals, or decision execution is provided.
115
+
116
+ © 2026 BPM RED Academy · All rights reserved.
117
+ """
118
+ )
119
 
120
  if __name__ == "__main__":
121
  demo.launch()