Spaces:
Sleeping
Sleeping
Update app.py with transformer embeddings and prediction pipeline
Browse files
app.py
CHANGED
@@ -71,10 +71,10 @@ def predict_with_gpflow(model, X):
|
|
71 |
print(model.signatures)
|
72 |
# Convert input to TensorFlow tensor
|
73 |
X_tensor = tf.convert_to_tensor(X, dtype=tf.float64)
|
74 |
-
|
75 |
# Get predictions
|
76 |
predict_fn = model.predict_f_compiled
|
77 |
-
mean, variance = predict_fn(X_tensor)
|
78 |
|
79 |
# Return mean and variance as numpy arrays
|
80 |
return mean.numpy().flatten(), variance.numpy().flatten()
|
@@ -99,6 +99,9 @@ def process_target(target, selected_models, sequence, prediction_type):
|
|
99 |
return target, round(y_pred, 2)
|
100 |
else:
|
101 |
# GPflow prediction
|
|
|
|
|
|
|
102 |
y_pred, y_uncertainty = predict_with_gpflow(model, embedding)
|
103 |
return target, round(y_pred[0], 2), round(y_uncertainty[0], 2)
|
104 |
|
|
|
71 |
print(model.signatures)
|
72 |
# Convert input to TensorFlow tensor
|
73 |
X_tensor = tf.convert_to_tensor(X, dtype=tf.float64)
|
74 |
+
print (X_tensor.shape)
|
75 |
# Get predictions
|
76 |
predict_fn = model.predict_f_compiled
|
77 |
+
mean, variance = predict_fn(X_new=X_tensor)
|
78 |
|
79 |
# Return mean and variance as numpy arrays
|
80 |
return mean.numpy().flatten(), variance.numpy().flatten()
|
|
|
99 |
return target, round(y_pred, 2)
|
100 |
else:
|
101 |
# GPflow prediction
|
102 |
+
print (esm_model_name)
|
103 |
+
print (layer)
|
104 |
+
print (model)
|
105 |
y_pred, y_uncertainty = predict_with_gpflow(model, embedding)
|
106 |
return target, round(y_pred[0], 2), round(y_uncertainty[0], 2)
|
107 |
|