kalpesh77 commited on
Commit
a27a6f9
ยท
verified ยท
1 Parent(s): bcdd9c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -35
app.py CHANGED
@@ -1,9 +1,6 @@
1
  """
2
  app.py โ€” HuggingFace Gradio Space
3
- ===================================
4
  Vedic Simulation Visualizer: Sri Yantra โ†” Quantum Field
5
-
6
- Deploy this file as a HuggingFace Space (Gradio SDK).
7
  """
8
 
9
  import gradio as gr
@@ -13,7 +10,7 @@ from PIL import Image
13
 
14
  from sri_yantra.visualizer import draw_sri_yantra
15
  from sri_yantra.quantum_mapping import (
16
- all_qubit_states, entanglement_matrix, bindu_ground_state
17
  )
18
 
19
 
@@ -36,23 +33,26 @@ def generate_sri_yantra(phase_shift, show_quantum, show_entanglement, show_label
36
  def qubit_table(phase_shift):
37
  """Return markdown table of all 9 qubit states."""
38
  states = all_qubit_states(phase_shift)
39
- rows = ["| Layer | Type | P(|0โŸฉ) Shiva | P(|1โŸฉ) Shakti | Vedic Name |",
40
- "|-------|------|-------------|--------------|------------|"]
 
 
41
  vedic_names = [
42
  "Sarva Siddhi Prada", "Sarva Shakti Mayi", "Sarva Raksha Kara",
43
  "Sarva Rogahara", "Sarva Siddhimaya", "Sarva Anandamaya",
44
  "Sarva Raksha Kara II", "Sarva Siddhiprada", "Bindu Mandala"
45
  ]
46
  for i, s in enumerate(states):
47
- name = vedic_names[i] if i < len(vedic_names) else "โ€”"
 
48
  rows.append(
49
- f"| {s['layer']} | {'โ–ฒ Shiva' if s['type']=='shiva' else 'โ–ฝ Shakti'} "
50
  f"| {s['prob_0']:.3f} | {s['prob_1']:.3f} | {name} |"
51
  )
52
  alpha, beta = bindu_ground_state(phase_shift)
53
  rows.append(
54
- f"\n**Bindu Ground State:** P(|0โŸฉ) = {abs(alpha)**2:.3f}, "
55
- f"P(|1โŸฉ) = {abs(beta)**2:.3f}"
56
  )
57
  return "\n".join(rows)
58
 
@@ -60,64 +60,66 @@ def qubit_table(phase_shift):
60
  # โ”€โ”€ Gradio UI โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
61
 
62
  with gr.Blocks(
63
- title="๐Ÿ•‰ Vedic Simulation Visualizer",
64
  theme=gr.themes.Base(
65
  primary_hue="orange",
66
  neutral_hue="stone",
67
- ),
68
- css="""
69
- .gradio-container { background: #0d0010 !important; }
70
- h1, h2, h3, p, label { color: #FFD700 !important; }
71
- """
72
  ) as demo:
73
 
74
  gr.Markdown("""
75
- # ๐Ÿ•‰ Sri Yantra โ†” Quantum Field Visualizer
76
- > **vedic-logic.blogspot.com** | Vedic Yantra-Tantra Multiverse โ€” Branch 2: Simulation Theory
77
 
78
  The Sri Yantra encodes a **9-qubit quantum register** in sacred geometry.
79
- Adjust the **quantum phase shift** to animate interference patterns.
80
  """)
81
 
82
  with gr.Row():
83
  with gr.Column(scale=1):
84
  phase = gr.Slider(
85
  0, 6.28, value=0.0, step=0.05,
86
- label="โš› Quantum Phase Shift (0 to 2ฯ€ radians)"
87
  )
88
  show_q = gr.Checkbox(value=True, label="Show Interference Field")
89
  show_e = gr.Checkbox(value=True, label="Show Entanglement Nodes")
90
  show_l = gr.Checkbox(value=True, label="Show Labels")
91
- btn = gr.Button("๐Ÿ”ฎ Render Yantra", variant="primary")
92
 
93
  with gr.Column(scale=2):
94
  image_out = gr.Image(label="Sri Yantra Visualization", type="pil")
95
 
96
- qubit_md = gr.Markdown(label="9 Qubit States")
97
 
98
- btn.click(fn=generate_sri_yantra,
99
- inputs=[phase, show_q, show_e, show_l],
100
- outputs=image_out)
101
- btn.click(fn=qubit_table,
102
- inputs=[phase],
103
- outputs=qubit_md)
 
 
 
 
104
 
105
  gr.Markdown("""
106
  ---
107
- ### Vedic โ†” Quantum Mapping
 
108
  | Vedic Concept | Quantum Equivalent |
109
  |---|---|
110
- | Bindu (central point) | Ground state \|ฯˆโ‚€โŸฉ โ€” wave function collapse |
111
- | 4 Shiva โ–ฒ triangles | \|0โŸฉ basis qubits |
112
- | 5 Shakti โ–ฝ triangles | \|1โŸฉ basis qubits |
113
  | Intersection points | Entanglement nodes |
114
- | Phase shift slider | Time evolution e^(iHt) |
115
  | Sri Yantra whole | Hilbert space manifold |
116
 
117
  ---
118
- ๐Ÿ”— [vedic-logic.blogspot.com](https://vedic-logic.blogspot.com) |
119
- ๐Ÿ™ [GitHub](https://github.com/kalpeshnitore/vedic-simulation)
120
  """)
121
 
122
 
123
  demo.launch()
 
 
1
  """
2
  app.py โ€” HuggingFace Gradio Space
 
3
  Vedic Simulation Visualizer: Sri Yantra โ†” Quantum Field
 
 
4
  """
5
 
6
  import gradio as gr
 
10
 
11
  from sri_yantra.visualizer import draw_sri_yantra
12
  from sri_yantra.quantum_mapping import (
13
+ all_qubit_states, bindu_ground_state
14
  )
15
 
16
 
 
33
  def qubit_table(phase_shift):
34
  """Return markdown table of all 9 qubit states."""
35
  states = all_qubit_states(phase_shift)
36
+ rows = [
37
+ "| Layer | Type | P(0) Shiva | P(1) Shakti | Vedic Name |",
38
+ "|-------|------|-----------|------------|------------|"
39
+ ]
40
  vedic_names = [
41
  "Sarva Siddhi Prada", "Sarva Shakti Mayi", "Sarva Raksha Kara",
42
  "Sarva Rogahara", "Sarva Siddhimaya", "Sarva Anandamaya",
43
  "Sarva Raksha Kara II", "Sarva Siddhiprada", "Bindu Mandala"
44
  ]
45
  for i, s in enumerate(states):
46
+ name = vedic_names[i] if i < len(vedic_names) else "-"
47
+ tri_type = "Shiva" if s['type'] == 'shiva' else "Shakti"
48
  rows.append(
49
+ f"| {s['layer']} | {tri_type} "
50
  f"| {s['prob_0']:.3f} | {s['prob_1']:.3f} | {name} |"
51
  )
52
  alpha, beta = bindu_ground_state(phase_shift)
53
  rows.append(
54
+ f"\n**Bindu Ground State:** P(0) = {abs(alpha)**2:.3f}, "
55
+ f"P(1) = {abs(beta)**2:.3f}"
56
  )
57
  return "\n".join(rows)
58
 
 
60
  # โ”€โ”€ Gradio UI โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
61
 
62
  with gr.Blocks(
63
+ title="Vedic Simulation Visualizer",
64
  theme=gr.themes.Base(
65
  primary_hue="orange",
66
  neutral_hue="stone",
67
+ )
 
 
 
 
68
  ) as demo:
69
 
70
  gr.Markdown("""
71
+ # ๐Ÿ•‰ Sri Yantra โ€” Quantum Field Visualizer
72
+ **vedic-logic.blogspot.com** | Branch 2: Simulation Theory
73
 
74
  The Sri Yantra encodes a **9-qubit quantum register** in sacred geometry.
75
+ Adjust the quantum phase shift to animate interference patterns.
76
  """)
77
 
78
  with gr.Row():
79
  with gr.Column(scale=1):
80
  phase = gr.Slider(
81
  0, 6.28, value=0.0, step=0.05,
82
+ label="Quantum Phase Shift (0 to 2pi radians)"
83
  )
84
  show_q = gr.Checkbox(value=True, label="Show Interference Field")
85
  show_e = gr.Checkbox(value=True, label="Show Entanglement Nodes")
86
  show_l = gr.Checkbox(value=True, label="Show Labels")
87
+ btn = gr.Button("Render Yantra", variant="primary")
88
 
89
  with gr.Column(scale=2):
90
  image_out = gr.Image(label="Sri Yantra Visualization", type="pil")
91
 
92
+ qubit_md = gr.Markdown()
93
 
94
+ btn.click(
95
+ fn=generate_sri_yantra,
96
+ inputs=[phase, show_q, show_e, show_l],
97
+ outputs=image_out
98
+ )
99
+ btn.click(
100
+ fn=qubit_table,
101
+ inputs=[phase],
102
+ outputs=qubit_md
103
+ )
104
 
105
  gr.Markdown("""
106
  ---
107
+ ### Vedic to Quantum Mapping
108
+
109
  | Vedic Concept | Quantum Equivalent |
110
  |---|---|
111
+ | Bindu (central point) | Ground state โ€” wave function collapse |
112
+ | 4 Shiva triangles (up) | Qubit in 0 basis |
113
+ | 5 Shakti triangles (down) | Qubit in 1 basis |
114
  | Intersection points | Entanglement nodes |
115
+ | Phase shift slider | Time evolution unitary operator |
116
  | Sri Yantra whole | Hilbert space manifold |
117
 
118
  ---
119
+ Blog: vedic-logic.blogspot.com |
120
+ GitHub: github.com/kalpeshnitore/vedic-simulation
121
  """)
122
 
123
 
124
  demo.launch()
125
+