Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
| 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=
|
|
|
|
|
|
|
|
|
|
| 62 |
title="πΈ Alien Civilization Simulator",
|
| 63 |
-
description="
|
| 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()
|