m7n commited on
Commit
8b67620
·
1 Parent(s): 33549cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -7,19 +7,14 @@ Original file is located at
7
  https://colab.research.google.com/drive/1omNn2hrbDL_s1qwCOr7ViaIjrRW61YDt
8
  """
9
 
10
- # !pip install gradio
11
-
12
  # Commented out IPython magic to ensure Python compatibility.
13
- #
14
  # %%capture
15
- # import multiprocessing
16
- #
17
- # multiprocessing.cpu_count()
18
  #
19
  # !pip install cmocean
20
- # !pip install git+https://github.com/MNoichl/mesa
21
  #
22
- # !pip install compress-pickle --quiet
23
 
24
  import random
25
  import pandas as pd
@@ -45,7 +40,10 @@ from scipy.stats import beta
45
 
46
  # Commented out IPython magic to ensure Python compatibility.
47
  # %%capture
48
- # !pip install git+https://github.com/MNoichl/opinionated.git#egg=opinionated
 
 
 
49
  import opinionated
50
  import matplotlib.pyplot as plt
51
 
@@ -54,6 +52,7 @@ from opinionated.core import download_googlefont
54
  download_googlefont('Quicksand', add_to_cache=True)
55
  plt.rc('font', family='Quicksand')
56
 
 
57
  experiences = {
58
  'dissident_experiences': [1,0,0],
59
  'supporter_experiences': [1,1,1],
@@ -585,7 +584,7 @@ def run_and_plot_simulation(n_agents=300, share_regime_supporters=0.4, threshold
585
  plt.plot(mean_estimation.index, mean_estimation, color='black', linewidth=2)
586
 
587
  # Set the plot title and labels
588
- plt.title('Agent Estimation Over Time')
589
  plt.xlabel('Time step')
590
  plt.ylabel('Estimation')
591
  return fig
@@ -600,7 +599,9 @@ import matplotlib.pyplot as plt
600
  # Gradio interface
601
  with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
602
  with gr.Column():
603
- gr.Markdown("# Simulation Visualization Interface")
 
 
604
  with gr.Row():
605
  with gr.Column():
606
 
 
7
  https://colab.research.google.com/drive/1omNn2hrbDL_s1qwCOr7ViaIjrRW61YDt
8
  """
9
 
 
 
10
  # Commented out IPython magic to ensure Python compatibility.
 
11
  # %%capture
12
+ # !pip install gradio
 
 
13
  #
14
  # !pip install cmocean
15
+ # !pip install mesa
16
  #
17
+ #
18
 
19
  import random
20
  import pandas as pd
 
40
 
41
  # Commented out IPython magic to ensure Python compatibility.
42
  # %%capture
43
+ # # !pip install git+https://github.com/MNoichl/opinionated.git#egg=opinionated
44
+ # # import opinionated
45
+ # # plt.style.use("opinionated_rc")
46
+ # !pip install opinionated
47
  import opinionated
48
  import matplotlib.pyplot as plt
49
 
 
52
  download_googlefont('Quicksand', add_to_cache=True)
53
  plt.rc('font', family='Quicksand')
54
 
55
+
56
  experiences = {
57
  'dissident_experiences': [1,0,0],
58
  'supporter_experiences': [1,1,1],
 
584
  plt.plot(mean_estimation.index, mean_estimation, color='black', linewidth=2)
585
 
586
  # Set the plot title and labels
587
+ plt.title('Agent Estimation Over Time', loc='right')
588
  plt.xlabel('Time step')
589
  plt.ylabel('Estimation')
590
  return fig
 
599
  # Gradio interface
600
  with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
601
  with gr.Column():
602
+ gr.Markdown("""# Simulate Revolutions
603
+ Agents are placed on a flly connected graph. Vary the parameters below, and click 'Run Simulation' to run.
604
+ """)
605
  with gr.Row():
606
  with gr.Column():
607