Ramlaoui commited on
Commit
a91474f
1 Parent(s): 1366f26

Add back all dataset

Browse files
Files changed (1) hide show
  1. app.py +14 -29
app.py CHANGED
@@ -40,7 +40,6 @@ dataset = load_dataset(
40
  ],
41
  )
42
 
43
- dataset = dataset.select(range(1000))
44
  # Convert the train split to a pandas DataFrame
45
  train_df = dataset.to_pandas()
46
  del dataset
@@ -119,21 +118,6 @@ layout = html.Div(
119
  )
120
 
121
 
122
- @app.callback(
123
- Output("material-dropdown", "options"),
124
- Output("material-dropdown", "value"),
125
- Input("materials-input", "submitButtonClicks"),
126
- Input("materials-input", "value"),
127
- )
128
- def on_submit_materials_input(n_clicks, query):
129
- if n_clicks is None or not query:
130
- return [], None
131
- options = search_materials(query)
132
- if not options:
133
- return [], None
134
- return options, options[0]["value"]
135
-
136
-
137
  # Function to search for materials
138
  def search_materials(query):
139
  element_list = [el.strip() for el in query.split(",")]
@@ -154,19 +138,20 @@ def search_materials(query):
154
  return options
155
 
156
 
157
- # # Callback to update the material dropdown based on search
158
- # @app.callback(
159
- # [Output("material-dropdown", "options"), Output("material-dropdown", "value")],
160
- # Input("search-button", "n_clicks"),
161
- # State("query-input", "value"),
162
- # )
163
- # def update_material_dropdown(n_clicks, query):
164
- # if n_clicks is None or not query:
165
- # return [], None
166
- # options = search_materials(query)
167
- # if not options:
168
- # return [], None
169
- # return options, options[0]["value"]
 
170
 
171
 
172
  # Callback to display the selected material
 
40
  ],
41
  )
42
 
 
43
  # Convert the train split to a pandas DataFrame
44
  train_df = dataset.to_pandas()
45
  del dataset
 
118
  )
119
 
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  # Function to search for materials
122
  def search_materials(query):
123
  element_list = [el.strip() for el in query.split(",")]
 
138
  return options
139
 
140
 
141
+ # Callback to update the material dropdown based on search
142
+ @app.callback(
143
+ Output("material-dropdown", "options"),
144
+ Output("material-dropdown", "value"),
145
+ Input("materials-input", "submitButtonClicks"),
146
+ Input("materials-input", "value"),
147
+ )
148
+ def on_submit_materials_input(n_clicks, query):
149
+ if n_clicks is None or not query:
150
+ return [], None
151
+ options = search_materials(query)
152
+ if not options:
153
+ return [], None
154
+ return options, options[0]["value"]
155
 
156
 
157
  # Callback to display the selected material