Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import numpy
|
|
4 |
import tensorflow
|
5 |
import math
|
6 |
from tensorflow.python.framework.ops import disable_eager_execution
|
|
|
|
|
7 |
|
8 |
# Because important
|
9 |
disable_eager_execution()
|
@@ -233,18 +235,20 @@ def generate_unit_cell(t, d, th):
|
|
233 |
|
234 |
def interpolate(t1, t2, d1, d2, th1, th2, steps):
|
235 |
# Load the decoder model
|
236 |
-
decoder_model_boxes =
|
|
|
237 |
|
238 |
# # import the encoder model architecture
|
239 |
-
json_file_loaded = open('data/model.json', 'r')
|
240 |
-
loaded_model_json = json_file_loaded.read()
|
241 |
|
242 |
# load model using the saved json file
|
243 |
-
encoder_model_boxes = tensorflow.keras.models.model_from_json(loaded_model_json)
|
244 |
|
245 |
# load weights into newly loaded_model
|
246 |
-
encoder_model_boxes.load_weights('data/model_tf')
|
247 |
-
|
|
|
248 |
num_internal = int(steps)
|
249 |
number_1 = generate_unit_cell(t1, d1, th1)
|
250 |
number_2 = generate_unit_cell(t2, d2, th2)
|
|
|
4 |
import tensorflow
|
5 |
import math
|
6 |
from tensorflow.python.framework.ops import disable_eager_execution
|
7 |
+
import huggingface_hub # for loading model
|
8 |
+
|
9 |
|
10 |
# Because important
|
11 |
disable_eager_execution()
|
|
|
235 |
|
236 |
def interpolate(t1, t2, d1, d2, th1, th2, steps):
|
237 |
# Load the decoder model
|
238 |
+
decoder_model_boxes = huggingface_hub.from_pretrained_keras("cmudrc/2d-lattice-decoder")
|
239 |
+
# decoder_model_boxes = tensorflow.keras.models.load_model('data/decoder_model_boxes', compile=False)
|
240 |
|
241 |
# # import the encoder model architecture
|
242 |
+
# json_file_loaded = open('data/model.json', 'r')
|
243 |
+
# loaded_model_json = json_file_loaded.read()
|
244 |
|
245 |
# load model using the saved json file
|
246 |
+
# encoder_model_boxes = tensorflow.keras.models.model_from_json(loaded_model_json)
|
247 |
|
248 |
# load weights into newly loaded_model
|
249 |
+
# encoder_model_boxes.load_weights('data/model_tf')
|
250 |
+
encoder_model_boxes = huggingface_hub.from_pretrained_keras("cmudrc/2d-lattice-encoder")
|
251 |
+
|
252 |
num_internal = int(steps)
|
253 |
number_1 = generate_unit_cell(t1, d1, th1)
|
254 |
number_2 = generate_unit_cell(t2, d2, th2)
|