Ramlaoui commited on
Commit
b99c699
1 Parent(s): 05297eb

Fix Layout

Browse files
Files changed (1) hide show
  1. app.py +27 -12
app.py CHANGED
@@ -60,8 +60,8 @@ display_names = {
60
  mapping_table_idx_dataset_idx = {}
61
 
62
  map_periodic_table = {v.symbol: k for k, v in enumerate(periodictable.elements)}
 
63
 
64
- dataset_index = np.zeros((len(dataset), 118))
65
  train_df = dataset.to_pandas()
66
 
67
  pattern = re.compile(r"(?P<element>[A-Z][a-z]?)(?P<count>\d*)")
@@ -125,20 +125,35 @@ layout = html.Div(
125
  html.Div(
126
  [
127
  html.H3("Search Materials (eg. 'Ac,Cd,Ge' or 'Ac2CdGe3')"),
128
- dmp.MaterialsInput(
129
- allowedInputTypes=["elements", "formula"],
130
- hidePeriodicTable=False,
131
- periodicTableMode="toggle",
132
- hideWildcardButton=True,
133
- showSubmitButton=True,
134
- submitButtonText="Search",
135
- type="elements",
136
- id="materials-input",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  ),
138
  ],
139
  style={
140
  "width": "100%",
141
- "display": "inline-block",
142
  "verticalAlign": "top",
143
  },
144
  ),
@@ -191,7 +206,7 @@ layout = html.Div(
191
 
192
 
193
  def search_materials(query):
194
- query_vector = np.zeros(118)
195
 
196
  if "," in query:
197
  element_list = [el.strip() for el in query.split(",")]
 
60
  mapping_table_idx_dataset_idx = {}
61
 
62
  map_periodic_table = {v.symbol: k for k, v in enumerate(periodictable.elements)}
63
+ n_elements = len(map_periodic_table)
64
 
 
65
  train_df = dataset.to_pandas()
66
 
67
  pattern = re.compile(r"(?P<element>[A-Z][a-z]?)(?P<count>\d*)")
 
125
  html.Div(
126
  [
127
  html.H3("Search Materials (eg. 'Ac,Cd,Ge' or 'Ac2CdGe3')"),
128
+ html.Div(
129
+ [
130
+ html.Div(
131
+ [
132
+ dmp.MaterialsInput(
133
+ allowedInputTypes=["elements", "formula"],
134
+ hidePeriodicTable=False,
135
+ periodicTableMode="toggle",
136
+ hideWildcardButton=True,
137
+ showSubmitButton=True,
138
+ submitButtonText="Search",
139
+ type="elements",
140
+ id="materials-input",
141
+ ),
142
+ ],
143
+ style={
144
+ "width": "48%",
145
+ },
146
+ ),
147
+ ],
148
+ style={
149
+ "display": "flex",
150
+ "justifyContent": "center",
151
+ "width": "100%",
152
+ },
153
  ),
154
  ],
155
  style={
156
  "width": "100%",
 
157
  "verticalAlign": "top",
158
  },
159
  ),
 
206
 
207
 
208
  def search_materials(query):
209
+ query_vector = np.zeros(n_elements)
210
 
211
  if "," in query:
212
  element_list = [el.strip() for el in query.split(",")]