ccm commited on
Commit
43ed509
·
1 Parent(s): 73f9323

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -22
app.py CHANGED
@@ -13,6 +13,30 @@ import plotly.graph_objects as go
13
  import random
14
  from huggingface_hub import from_pretrained_keras
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  # Disable eager execution because its bad
17
  from tensorflow.python.framework.ops import disable_eager_execution
18
  disable_eager_execution()
@@ -1073,28 +1097,28 @@ def make_voxels(shape, length, height, width, diameter):
1073
  return plotly_fig(make_voxels_without_figure(shape, length, height, width, diameter))
1074
 
1075
  # This function loads a fuckton of data
1076
- def load_data():
1077
- # Open all the files we downloaded at the beginning and take out hte good bits
1078
- curves = numpy.load('data_curves.npz')['curves']
1079
- geometry = numpy.load('data_geometry.npz')['geometry']
1080
- constants = numpy.load('constants.npz')
1081
- S = constants['S']
1082
- N = constants['N']
1083
- D = constants['D']
1084
- F = constants['F']
1085
- G = constants['G']
1086
-
1087
- # Some of the good bits need additional processining
1088
- new_curves = numpy.zeros((S*N, D * F))
1089
- for i, curveset in enumerate(curves):
1090
- new_curves[i, :] = curveset.T.flatten() / 1000000
1091
-
1092
- new_geometry = numpy.zeros((S*N, G * G * G))
1093
- for i, geometryset in enumerate(geometry):
1094
- new_geometry[i, :] = geometryset.T.flatten()
1095
-
1096
- # Return good bits to user
1097
- return curves, geometry, S, N, D, F, G, new_curves, new_geometry
1098
 
1099
  curves, geometry, S, N, D, F, G, new_curves, new_geometry = load_data()
1100
 
 
13
  import random
14
  from huggingface_hub import from_pretrained_keras
15
 
16
+ def load_data():
17
+
18
+ from datasets import load_dataset
19
+
20
+ data = load_dataset("cmudrc/wave-energy", data_files="data.csv", split='train').to_pandas()
21
+
22
+ # Open all the files we downloaded at the beginning and take out hte good bits
23
+ curves = data.iloc[:, [i for i in range(1, 3*64+1)]]
24
+ geometry = data.iloc[:, [i for i in range(1 + 3*64, 1 + 3*64 + 32**3)]]
25
+ S = 5
26
+ N = 1000
27
+ D = 3
28
+ F = 64
29
+ G = 32
30
+
31
+ flattened_curves = curves.values / 1000000
32
+ curvey_curves = [c.reshape([3, 64]) for c in flattened_curves]
33
+
34
+ flattened_geometry = geometry.values
35
+ round_geometry = [g.reshape([32, 32, 32]) for g in flattened_geometry]
36
+
37
+ # Return good bits to user
38
+ return curvey_curves, round_geometry, S, N, D, F, G, flattened_curves, flattened_geometry
39
+
40
  # Disable eager execution because its bad
41
  from tensorflow.python.framework.ops import disable_eager_execution
42
  disable_eager_execution()
 
1097
  return plotly_fig(make_voxels_without_figure(shape, length, height, width, diameter))
1098
 
1099
  # This function loads a fuckton of data
1100
+ # def load_data():
1101
+ # # Open all the files we downloaded at the beginning and take out hte good bits
1102
+ # curves = numpy.load('data_curves.npz')['curves']
1103
+ # geometry = numpy.load('data_geometry.npz')['geometry']
1104
+ # constants = numpy.load('constants.npz')
1105
+ # S = constants['S']
1106
+ # N = constants['N']
1107
+ # D = constants['D']
1108
+ # F = constants['F']
1109
+ # G = constants['G']
1110
+
1111
+ # # Some of the good bits need additional processining
1112
+ # new_curves = numpy.zeros((S*N, D * F))
1113
+ # for i, curveset in enumerate(curves):
1114
+ # new_curves[i, :] = curveset.T.flatten() / 1000000
1115
+
1116
+ # new_geometry = numpy.zeros((S*N, G * G * G))
1117
+ # for i, geometryset in enumerate(geometry):
1118
+ # new_geometry[i, :] = geometryset.T.flatten()
1119
+
1120
+ # # Return good bits to user
1121
+ # return curves, geometry, S, N, D, F, G, new_curves, new_geometry
1122
 
1123
  curves, geometry, S, N, D, F, G, new_curves, new_geometry = load_data()
1124