jbilcke-hf HF staff commited on
Commit
f9e9c71
1 Parent(s): 49a7080

fix for model rehydration

Browse files
src/app/interface/generate/index.tsx CHANGED
@@ -137,7 +137,7 @@ export function Generate() {
137
  const models = await getSDXLModels()
138
  setModels(models)
139
 
140
- const defaultModel = models.find(model => model.title.toLowerCase().includes("ghibli")) || models[0]
141
 
142
  if (defaultModel) {
143
  setSelectedModel(defaultModel)
@@ -157,7 +157,14 @@ export function Generate() {
157
  }
158
 
159
  if (existingModelName) {
160
- let existingModel = models.find(model => model.title.toLowerCase().trim().includes(existingModelName))
 
 
 
 
 
 
 
161
  if (existingModel) {
162
  setSelectedModel(existingModel)
163
  }
@@ -176,8 +183,16 @@ export function Generate() {
176
  }
177
 
178
  if (post.model) {
179
- const existingModel = models.find(model => model.title.toLowerCase().trim().includes(post.model.toLowerCase().trim()))
180
-
 
 
 
 
 
 
 
 
181
  if (existingModel) {
182
  setSelectedModel(existingModel)
183
  }
@@ -225,8 +240,15 @@ export function Generate() {
225
  }
226
 
227
  if (post.model) {
228
- const existingModel = models.find(model => model.title.toLowerCase().trim().includes(post.model.toLowerCase().trim()))
229
-
 
 
 
 
 
 
 
230
  if (existingModel) {
231
  setSelectedModel(existingModel)
232
  }
 
137
  const models = await getSDXLModels()
138
  setModels(models)
139
 
140
+ const defaultModel = models.find(model => model.repo.toLowerCase().includes("ghibli")) || models[0]
141
 
142
  if (defaultModel) {
143
  setSelectedModel(defaultModel)
 
157
  }
158
 
159
  if (existingModelName) {
160
+
161
+ let existingModel = models.find(model => {
162
+ return (
163
+ model.repo.toLowerCase().trim().includes(existingModelName)
164
+ || model.title.toLowerCase().trim().includes(existingModelName)
165
+ )
166
+ })
167
+
168
  if (existingModel) {
169
  setSelectedModel(existingModel)
170
  }
 
183
  }
184
 
185
  if (post.model) {
186
+
187
+ const nameToFind = post.model.toLowerCase().trim()
188
+ const existingModel = models.find(model => {
189
+
190
+ return (
191
+ model.repo.toLowerCase().trim().includes(nameToFind)
192
+ || model.title.toLowerCase().trim().includes(nameToFind)
193
+ )
194
+ })
195
+
196
  if (existingModel) {
197
  setSelectedModel(existingModel)
198
  }
 
240
  }
241
 
242
  if (post.model) {
243
+ const nameToFind = post.model.toLowerCase().trim()
244
+ const existingModel = models.find(model => {
245
+
246
+ return (
247
+ model.repo.toLowerCase().trim().includes(nameToFind)
248
+ || model.title.toLowerCase().trim().includes(nameToFind)
249
+ )
250
+ })
251
+
252
  if (existingModel) {
253
  setSelectedModel(existingModel)
254
  }