Update app.py
Browse files
app.py
CHANGED
@@ -170,30 +170,12 @@ class Network(object):
|
|
170 |
return table
|
171 |
|
172 |
forward_net = Network("16forward_structure.json", "16forward_weights.h5")
|
173 |
-
|
174 |
-
def simple_analysis(index):
|
175 |
-
return forward_net.analysis(index)
|
176 |
-
|
177 |
inverse_net = Network("16inverse_structure.json", "16inverse_weights.h5")
|
178 |
|
179 |
-
|
180 |
-
pred, true = inverse_net.synthesis(index)
|
181 |
-
return plotly_fig(pred), plotly_fig(true)
|
182 |
-
|
183 |
-
def synthesis_from_spectrum(df):
|
184 |
-
pred = inverse_net.synthesis_from_spectrum(df.to_numpy())
|
185 |
-
return plotly_fig(pred)
|
186 |
-
|
187 |
import plotly.graph_objects as go
|
188 |
import numpy as np
|
189 |
|
190 |
-
def performance(index):
|
191 |
-
return forward_net.get_performance(index)
|
192 |
-
|
193 |
-
def geometry(index):
|
194 |
-
values = forward_net.get_geometry(index)
|
195 |
-
return plotly_fig(values)
|
196 |
-
|
197 |
|
198 |
def plotly_fig(values):
|
199 |
X, Y, Z = np.mgrid[0:1:32j, 0:1:32j, 0:1:32j]
|
@@ -208,6 +190,26 @@ def plotly_fig(values):
|
|
208 |
surface_count=21, # needs to be a large number for good volume rendering
|
209 |
))
|
210 |
return fig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
|
212 |
with gradio.Blocks() as analysis_demo:
|
213 |
with gradio.Row():
|
|
|
170 |
return table
|
171 |
|
172 |
forward_net = Network("16forward_structure.json", "16forward_weights.h5")
|
|
|
|
|
|
|
|
|
173 |
inverse_net = Network("16inverse_structure.json", "16inverse_weights.h5")
|
174 |
|
175 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
import plotly.graph_objects as go
|
177 |
import numpy as np
|
178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
def plotly_fig(values):
|
181 |
X, Y, Z = np.mgrid[0:1:32j, 0:1:32j, 0:1:32j]
|
|
|
190 |
surface_count=21, # needs to be a large number for good volume rendering
|
191 |
))
|
192 |
return fig
|
193 |
+
|
194 |
+
|
195 |
+
def performance(index):
|
196 |
+
return forward_net.get_performance(index)
|
197 |
+
|
198 |
+
def geometry(index):
|
199 |
+
values = forward_net.get_geometry(index)
|
200 |
+
return plotly_fig(values)
|
201 |
+
|
202 |
+
def simple_analysis(index):
|
203 |
+
return forward_net.analysis(index)
|
204 |
+
|
205 |
+
def simple_synthesis(index):
|
206 |
+
pred, true = inverse_net.synthesis(index)
|
207 |
+
return plotly_fig(pred), plotly_fig(true)
|
208 |
+
|
209 |
+
def synthesis_from_spectrum(df):
|
210 |
+
pred = inverse_net.synthesis_from_spectrum(df.to_numpy())
|
211 |
+
return plotly_fig(pred)
|
212 |
+
|
213 |
|
214 |
with gradio.Blocks() as analysis_demo:
|
215 |
with gradio.Row():
|