SreekarB commited on
Commit
7dd36eb
·
verified ·
1 Parent(s): dfe19ad

Upload 2 files

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -2290,7 +2290,20 @@ def create_interface():
2290
  treatment_outcomes = treatment_df['outcome_score'].values
2291
  logger.info(f"Using treatment outcomes from {treatment_file}")
2292
  else:
2293
- # Create a fallback set of treatment outcomes
 
 
 
 
 
 
 
 
 
 
 
 
 
2294
  logger.info("No treatment outcomes found - creating mock data")
2295
  n_samples = len(app_state['latents'])
2296
 
@@ -2377,17 +2390,7 @@ def create_interface():
2377
  metrics_text = f"{metrics_text}\n\nNOTE: Using synthetic data for demonstration."
2378
 
2379
  return [importance_fig, performance_fig, metrics_text]
2380
- else:
2381
- # No treatment file available
2382
- error_fig = plt.figure(figsize=(10, 6))
2383
- message = "Error: Treatment outcomes file not found. Please retrain the VAE in Tab 1."
2384
- plt.text(0.5, 0.5, message,
2385
- horizontalalignment='center', verticalalignment='center',
2386
- fontsize=14, color='red')
2387
- plt.axis('off')
2388
 
2389
- return [error_fig, error_fig, "Error: Treatment outcomes file not found."]
2390
-
2391
  except Exception as e:
2392
  logger.error(f"Error in RF training: {str(e)}", exc_info=True)
2393
  error_fig = plt.figure(figsize=(10, 6))
 
2290
  treatment_outcomes = treatment_df['outcome_score'].values
2291
  logger.info(f"Using treatment outcomes from {treatment_file}")
2292
  else:
2293
+ # Check if we should show an error or use mock data
2294
+ if not app_state.get('synthetic_data', False):
2295
+ # Show error for missing treatment file
2296
+ logger.error("No treatment file available and not using synthetic data")
2297
+ error_fig = plt.figure(figsize=(10, 6))
2298
+ message = "Error: Treatment outcomes file not found. Please retrain the VAE in Tab 1."
2299
+ plt.text(0.5, 0.5, message,
2300
+ horizontalalignment='center', verticalalignment='center',
2301
+ fontsize=14, color='red')
2302
+ plt.axis('off')
2303
+
2304
+ return [error_fig, error_fig, "Error: Treatment outcomes file not found."]
2305
+
2306
+ # Create a fallback set of treatment outcomes for synthetic data
2307
  logger.info("No treatment outcomes found - creating mock data")
2308
  n_samples = len(app_state['latents'])
2309
 
 
2390
  metrics_text = f"{metrics_text}\n\nNOTE: Using synthetic data for demonstration."
2391
 
2392
  return [importance_fig, performance_fig, metrics_text]
 
 
 
 
 
 
 
 
2393
 
 
 
2394
  except Exception as e:
2395
  logger.error(f"Error in RF training: {str(e)}", exc_info=True)
2396
  error_fig = plt.figure(figsize=(10, 6))