WeVi commited on
Commit
3227384
Β·
verified Β·
1 Parent(s): 6997730

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -5
app.py CHANGED
@@ -13,7 +13,7 @@ def drake_simulator(R_star, f_p, n_e, f_l, f_i, f_c, L):
13
  intelligent = int(habitable * f_i)
14
  communicative = int(intelligent * f_c)
15
 
16
- # Create a galaxy visualization
17
  fig, ax = plt.subplots(figsize=(6, 6))
18
  ax.set_facecolor("black")
19
  ax.set_title(f"Estimated Civilizations: {int(N)}", color="white")
@@ -44,9 +44,20 @@ def drake_simulator(R_star, f_p, n_e, f_l, f_i, f_c, L):
44
  com_y = int_y[:communicative]
45
  ax.scatter(com_x, com_y, color="red", s=8)
46
 
47
- return fig
 
 
 
 
 
 
 
 
 
48
 
49
- # Gradio UI
 
 
50
  interface = gr.Interface(
51
  fn=drake_simulator,
52
  inputs=[
@@ -58,9 +69,12 @@ interface = gr.Interface(
58
  gr.Slider(0.0, 1.0, value=0.5, label="fc (Communicative Fraction)"),
59
  gr.Slider(0.1, 10000, value=1000, label="L (Signal Lifetime)")
60
  ],
61
- outputs=gr.Plot(),
 
 
 
62
  title="πŸ›Έ Alien Civilization Simulator",
63
- description="Visualize the Drake Equation in Action πŸš€"
64
  )
65
 
66
  interface.launch()
 
13
  intelligent = int(habitable * f_i)
14
  communicative = int(intelligent * f_c)
15
 
16
+ # Create galaxy plot
17
  fig, ax = plt.subplots(figsize=(6, 6))
18
  ax.set_facecolor("black")
19
  ax.set_title(f"Estimated Civilizations: {int(N)}", color="white")
 
44
  com_y = int_y[:communicative]
45
  ax.scatter(com_x, com_y, color="red", s=8)
46
 
47
+ # Text description
48
+ annotation = f"""
49
+ 🧠 **Alien Civilization Layers**
50
+ ⭐ White = All Stars in Galaxy
51
+ πŸ”΅ Blue = Stars with Planets ({planets})
52
+ 🟒 Green = Habitable Planets ({habitable})
53
+ 🟑 Yellow = Intelligent Life ({intelligent})
54
+ πŸ”΄ Red = Communicative Civilizations ({communicative})
55
+ πŸ“‘ **Estimated Total Civilizations (N): {int(N)}**
56
+ """
57
 
58
+ return fig, annotation
59
+
60
+ # Gradio Interface
61
  interface = gr.Interface(
62
  fn=drake_simulator,
63
  inputs=[
 
69
  gr.Slider(0.0, 1.0, value=0.5, label="fc (Communicative Fraction)"),
70
  gr.Slider(0.1, 10000, value=1000, label="L (Signal Lifetime)")
71
  ],
72
+ outputs=[
73
+ gr.Plot(label="πŸͺ Galactic Simulation"),
74
+ gr.Markdown(label="πŸ“ Explanation")
75
+ ],
76
  title="πŸ›Έ Alien Civilization Simulator",
77
+ description="Explore the Drake Equation in a galactic simulation 🌌. Adjust the values and watch the cosmic dance of life possibilities."
78
  )
79
 
80
  interface.launch()