mansurarief commited on
Commit
823febe
1 Parent(s): e1b8702

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -4,6 +4,8 @@ import pandas as pd
4
  import numpy as np
5
  from scipy.stats import multivariate_normal as mvn
6
  import random
 
 
7
  # import plotly.graph_objects as go
8
 
9
 
@@ -69,6 +71,12 @@ def get_density(city):
69
 
70
 
71
  def get_energy_yield(production, injection, group, length=30):
 
 
 
 
 
 
72
  density = get_density(production)
73
  gamma = gammas[cities.index(production)]
74
  dist = random.uniform(0.98, 1.02)
@@ -91,13 +99,10 @@ def get_energy_yield(production, injection, group, length=30):
91
  total_text = f"Total Energy Yield for 30 years: {total_yield:.2f} MWh"
92
 
93
  #if group is empty, return warning as text label
94
- if group == "":
95
- total_text = "Please enter your group number"
96
- plt = gr.ScatterPlot()
97
- return total_text, plt
98
- else:
99
- log_final_decision(group, total_yield, injection, production, SUMMARY_TABLE_URL)
100
- return total_text, plt
101
 
102
 
103
 
 
4
  import numpy as np
5
  from scipy.stats import multivariate_normal as mvn
6
  import random
7
+ import json
8
+ import requests
9
  # import plotly.graph_objects as go
10
 
11
 
 
71
 
72
 
73
  def get_energy_yield(production, injection, group, length=30):
74
+
75
+ if group == "" or injection is None or production is None:
76
+ total_text = "Make sure to select injection well, production well, and enter your group number"
77
+ plt = gr.ScatterPlot()
78
+ return total_text, plt
79
+
80
  density = get_density(production)
81
  gamma = gammas[cities.index(production)]
82
  dist = random.uniform(0.98, 1.02)
 
99
  total_text = f"Total Energy Yield for 30 years: {total_yield:.2f} MWh"
100
 
101
  #if group is empty, return warning as text label
102
+
103
+
104
+ log_final_decision(group, total_yield, injection, production, SUMMARY_TABLE_URL)
105
+ return total_text, plt
 
 
 
106
 
107
 
108