ccm commited on
Commit
663ab52
1 Parent(s): 3954d2a

Better initial values

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -249,6 +249,10 @@ thickness_options = [str(int(x)) for x in numpy.linspace(0, 10, 11)]
249
  interpolation_options = [str(int(x)) for x in [3, 5, 10, 20]]
250
 
251
 
 
 
 
 
252
  def interpolate(t1, t2, d1, d2, th1, th2, steps):
253
  # Load the decoder model
254
  decoder_model_boxes = tensorflow.keras.models.load_model('data/decoder_model_boxes', compile=False)
@@ -264,8 +268,8 @@ def interpolate(t1, t2, d1, d2, th1, th2, steps):
264
  encoder_model_boxes.load_weights('data/model_tf')
265
 
266
  num_internal = int(steps)
267
- number_1 = globals()[t1](int(th1), float(d1), 28)
268
- number_2 = globals()[t2](int(th2), float(d2), 28)
269
 
270
  # resize the array to match the prediction size requirement
271
  number_1_expand = numpy.expand_dims(numpy.expand_dims(number_1, axis=2), axis=0)
@@ -302,22 +306,18 @@ def interpolate(t1, t2, d1, d2, th1, th2, steps):
302
  return transition_region
303
 
304
 
305
- def generate_unit_cell(t, d, th):
306
- return globals()[t](int(th), float(d), 28)
307
-
308
-
309
  with gradio.Blocks() as demo:
310
  with gradio.Row():
311
  with gradio.Column(min_width=250):
312
- t1 = gradio.Dropdown(endpoint_options, label="Type 1", value=random.choice(endpoint_options))
313
- d1 = gradio.Dropdown(density_options, label="Density 1", value=random.choice(density_options))
314
- th1 = gradio.Dropdown(thickness_options, label="Thickness 1", value=random.choice(thickness_options))
315
  with gradio.Column(min_width=250):
316
- img1 = gradio.Image(label="Endpoint 1")
317
  with gradio.Column(min_width=250):
318
- t2 = gradio.Dropdown(endpoint_options, label="Type 2", value=random.choice(endpoint_options))
319
- d2 = gradio.Dropdown(density_options, label="Density 2", value=random.choice(density_options))
320
- th2 = gradio.Dropdown(thickness_options, label="Thickness 2", value=random.choice(thickness_options))
321
  with gradio.Column(min_width=250):
322
  img2 = gradio.Image(label="Endpoint 2")
323
 
 
249
  interpolation_options = [str(int(x)) for x in [3, 5, 10, 20]]
250
 
251
 
252
+ def generate_unit_cell(t, d, th):
253
+ return globals()[t](int(th), float(d), 28)
254
+
255
+
256
  def interpolate(t1, t2, d1, d2, th1, th2, steps):
257
  # Load the decoder model
258
  decoder_model_boxes = tensorflow.keras.models.load_model('data/decoder_model_boxes', compile=False)
 
268
  encoder_model_boxes.load_weights('data/model_tf')
269
 
270
  num_internal = int(steps)
271
+ number_1 = generate_unit_cell(t1, d1, th1)
272
+ number_2 = generate_unit_cell(t2, d2, th2)
273
 
274
  # resize the array to match the prediction size requirement
275
  number_1_expand = numpy.expand_dims(numpy.expand_dims(number_1, axis=2), axis=0)
 
306
  return transition_region
307
 
308
 
 
 
 
 
309
  with gradio.Blocks() as demo:
310
  with gradio.Row():
311
  with gradio.Column(min_width=250):
312
+ t1 = gradio.Dropdown(endpoint_options, label="Type 1", value="hamburger_box")
313
+ d1 = gradio.Dropdown(density_options, label="Density 1", value="1.00")
314
+ th1 = gradio.Dropdown(thickness_options, label="Thickness 1", value="2")
315
  with gradio.Column(min_width=250):
316
+ img1 = gradio.Image(label="Endpoint 1", value=)
317
  with gradio.Column(min_width=250):
318
+ t2 = gradio.Dropdown(endpoint_options, label="Type 2", value="hot_dog_box")
319
+ d2 = gradio.Dropdown(density_options, label="Density 2", value="1.00")
320
+ th2 = gradio.Dropdown(thickness_options, label="Thickness 2", value="2")
321
  with gradio.Column(min_width=250):
322
  img2 = gradio.Image(label="Endpoint 2")
323