RFTSystems commited on
Commit
ce0550f
·
verified ·
1 Parent(s): 9ab0625

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -4,7 +4,11 @@ import os
4
  import matplotlib.pyplot as plt # Kept for potential future gr.Plot use or if figures are handled directly
5
  from simulation import RFTSimulation
6
  from utils import export_json, seed_everything
7
- from IPython.display import Image, display # For Colab dev mode inline image display
 
 
 
 
8
 
9
  # Helper function to run simulation and generate plots/export data
10
  def run_simulation_and_plot(num_agents, steps, mutation_rate, drift_rate, seed=None):
@@ -67,8 +71,7 @@ iface = gr.Interface(
67
  )
68
 
69
  # Colab-friendly "dev mode" or Gradio launch logic
70
- # Check if running in Colab environment (simple heuristic)
71
- IN_COLAB = 'COLAB_GPU' in os.environ or 'Google' in os.environ.get('COLAB_CLOUD_PLATFORM', '')
72
 
73
  if IN_COLAB:
74
  print("Running in Colab development mode (skipping Gradio launch).")
 
4
  import matplotlib.pyplot as plt # Kept for potential future gr.Plot use or if figures are handled directly
5
  from simulation import RFTSimulation
6
  from utils import export_json, seed_everything
7
+
8
+ # Conditionally import IPython.display only if in Colab
9
+ IN_COLAB = 'COLAB_GPU' in os.environ or 'Google' in os.environ.get('COLAB_CLOUD_PLATFORM', '')
10
+ if IN_COLAB:
11
+ from IPython.display import Image, display # For Colab dev mode inline image display
12
 
13
  # Helper function to run simulation and generate plots/export data
14
  def run_simulation_and_plot(num_agents, steps, mutation_rate, drift_rate, seed=None):
 
71
  )
72
 
73
  # Colab-friendly "dev mode" or Gradio launch logic
74
+ # The IN_COLAB check is now done at the top for conditional import
 
75
 
76
  if IN_COLAB:
77
  print("Running in Colab development mode (skipping Gradio launch).")