Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|