ahmedfaiyaz commited on
Commit
0dfd0ac
1 Parent(s): e611034

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +458 -102
app.py CHANGED
@@ -8,109 +8,466 @@ align-items:center;
8
  justify-content:center
9
 
10
  }
11
-
12
  """
13
-
 
 
 
 
 
14
  #updated username
15
- pipeline = DiffusionPipeline.from_pretrained("ahmedfaiyaz/OkkhorDiffusion",custom_pipeline="gr33nr1ng3r/OkkhorDiffusion",embedding=torch.float16)
16
  character_mappings = {
17
- 'অ': 1,
18
- 'আ': 2,
19
- 'ই': 3,
20
- 'ঈ': 4,
21
- 'উ': 5,
22
- 'ঊ': 6,
23
- 'ঋ': 7,
24
- 'এ': 8,
25
- 'ঐ': 9,
26
- 'ও': 10,
27
- 'ঔ': 11,
28
- 'ক': 12,
29
- 'খ': 13,
30
- 'গ': 14,
31
- 'ঘ': 15,
32
- 'ঙ': 16,
33
- 'চ': 17,
34
- 'ছ': 18,
35
- 'জ': 19,
36
- 'ঝ': 20,
37
- 'ঞ': 21,
38
- 'ট': 22,
39
- 'ঠ': 23,
40
- 'ড': 24,
41
- 'ঢ': 25,
42
- 'ণ': 26,
43
- 'ত': 27,
44
- 'থ': 28,
45
- 'দ': 29,
46
- 'ধ': 30,
47
- 'ন': 31,
48
- 'প': 32,
49
- 'ফ': 33,
50
- 'ব': 34,
51
- 'ভ': 35,
52
- 'ম': 36,
53
- 'য': 37,
54
- 'র': 38,
55
- 'ল': 39,
56
- 'শ': 40,
57
- 'ষ': 41,
58
- 'স': 42,
59
- 'হ': 43,
60
- 'ড়': 44,
61
- 'ঢ়': 45,
62
- 'য়': 46,
63
- 'ৎ': 47,
64
- 'ং': 48,
65
- 'ঃ': 49,
66
- 'ঁ': 50,
67
- '০': 51,
68
- '১': 52,
69
- '২': 53,
70
- '৩': 54,
71
- '৪': 55,
72
- '৫': 56,
73
- '৬': 57,
74
- '৭': 58,
75
- '৮': 59,
76
- '৯': 60,
77
- 'ক্ষ(ksa)': 61,
78
- 'ব্দ(bda)': 62,
79
- 'ঙ্গ': 63,
80
- 'স্ক': 64,
81
- 'স্ফ': 65,
82
- 'স্থ': 66,
83
- 'চ্ছ': 67,
84
- 'ক্ত': 68,
85
- 'স্ন': 69,
86
- 'ষ্ণ': 70,
87
- 'ম্প': 71,
88
- 'হ্ম': 72,
89
- 'প্ত': 73,
90
- 'ম্ব': 74,
91
- 'ন্ড': 75,
92
- 'দ্ভ': 76,
93
- 'ত্থ': 77,
94
- 'ষ্ঠ': 78,
95
- 'ল্প': 79,
96
- 'ষ্প': 80,
97
- 'ন্দ': 81,
98
- 'ন্ধ': 82,
99
- 'ম্ম': 83,
100
- 'ন্ঠ': 84,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
 
103
- def generate(input_text:str,batch_size:int,inference_steps:int):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  batch_size=int(batch_size)
105
  inference_steps=int(inference_steps)
106
  print(f"Generating image with label:{character_mappings[input_text]} batch size:{batch_size}")
107
- label=int(character_mappings[input_text])
108
- label-=1
109
  pipeline.embedding=torch.tensor([label])
110
  generate_image=pipeline(batch_size=batch_size,num_inference_steps=inference_steps).images
111
  return generate_image
112
 
113
 
 
 
 
 
 
 
 
 
 
114
 
115
  with gr.Blocks(css=css,elem_id="panel") as od_app:
116
  with gr.Column(min_width=100):
@@ -120,15 +477,19 @@ with gr.Blocks(css=css,elem_id="panel") as od_app:
120
  <h1> Okkhor Diffusion </h1>
121
  </div>
122
  </div>
123
-
124
  """)
125
  #input panel
126
-
 
 
127
  with gr.Row(elem_id="input-panel"):
 
128
  with gr.Column(variant="panel",scale=0,elem_id="input-panel-items"):
129
- dropdown = gr.Dropdown(label="Select Character",choices=list(character_mappings.keys()))
 
130
  batch_size = gr.Number(label="Batch Size", minimum=0, maximum=100)
131
  inference_steps= gr.Slider(label="Steps",value=100,minimum=100,maximum=1000,step=100)
 
132
  btn = gr.Button("Generate",size="sm")
133
 
134
 
@@ -136,13 +497,8 @@ with gr.Blocks(css=css,elem_id="panel") as od_app:
136
  label="Generated images", show_label=False, elem_id="gallery"
137
  , columns=[10], rows=[10], object_fit="contain", height="auto",scale=1,min_width=80)
138
 
139
-
140
- btn.click(fn=generate,inputs=[dropdown,batch_size,inference_steps],outputs=[gallery])
141
-
142
  if __name__=='__main__':
143
- od_app.queue(max_size=20).launch(show_error=True)
144
-
145
-
146
-
147
-
148
-
 
8
  justify-content:center
9
 
10
  }
 
11
  """
12
+ modelnames=[
13
+ "ahmedfaiyaz/OkkhorDiffusion",
14
+ "ahmedfaiyaz/OkkhorDiffusion-CMATERdb",
15
+ "ahmedfaiyaz/OkkhorDiffusion-Ekush"
16
+ ]
17
+ current_model="ahmedfaiyaz/OkkhorDiffusion"
18
  #updated username
19
+ pipeline = DiffusionPipeline.from_pretrained(current_model,custom_pipeline="ahmedfaiyaz/OkkhorDiffusion",embedding=torch.float16)
20
  character_mappings = {
21
+ 'অ': 0,
22
+ 'আ': 1,
23
+ 'ই': 2,
24
+ 'ঈ': 3,
25
+ 'উ': 4,
26
+ 'ঊ': 5,
27
+ 'ঋ': 6,
28
+ 'এ': 7,
29
+ 'ঐ': 8,
30
+ 'ও': 9,
31
+ 'ঔ': 10,
32
+ 'ক': 11,
33
+ 'খ': 12,
34
+ 'গ': 13,
35
+ 'ঘ': 14,
36
+ 'ঙ': 15,
37
+ 'চ': 16,
38
+ 'ছ': 17,
39
+ 'জ': 18,
40
+ 'ঝ': 19,
41
+ 'ঞ': 20,
42
+ 'ট': 21,
43
+ 'ঠ': 22,
44
+ 'ড': 23,
45
+ 'ঢ': 24,
46
+ 'ণ': 25,
47
+ 'ত': 26,
48
+ 'থ': 27,
49
+ 'দ': 28,
50
+ 'ধ': 29,
51
+ 'ন': 30,
52
+ 'প': 31,
53
+ 'ফ': 32,
54
+ 'ব': 33,
55
+ 'ভ': 34,
56
+ 'ম': 35,
57
+ 'য': 36,
58
+ 'র': 37,
59
+ 'ল': 38,
60
+ 'শ': 39,
61
+ 'ষ': 40,
62
+ 'স': 41,
63
+ 'হ': 42,
64
+ 'ড়': 43,
65
+ 'ঢ়': 44,
66
+ 'য়': 45,
67
+ 'ৎ': 46,
68
+ 'ং': 47,
69
+ 'ঃ': 48,
70
+ 'ঁ': 49,
71
+ '০': 50,
72
+ '১': 51,
73
+ '২': 52,
74
+ '৩': 53,
75
+ '৪': 54,
76
+ '৫': 55,
77
+ '৬': 56,
78
+ '৭': 57,
79
+ '৮': 58,
80
+ '৯': 59,
81
+ 'ক্ষ(ksa)': 60,
82
+ 'ব্দ(bda)': 61,
83
+ 'ঙ্গ': 62,
84
+ 'স্ক': 63,
85
+ 'স্ফ': 64,
86
+ 'স্থ': 65,
87
+ 'চ্ছ': 66,
88
+ 'ক্ত': 67,
89
+ 'স্ন': 68,
90
+ 'ষ্ণ': 69,
91
+ 'ম্প': 70,
92
+ 'হ্ম': 71,
93
+ 'প্ত': 72,
94
+ 'ম্ব': 73,
95
+ 'ন্ড': 74,
96
+ 'দ্ভ': 75,
97
+ 'ত্থ': 76,
98
+ 'ষ্ঠ': 77,
99
+ 'ল্প': 78,
100
+ 'ষ্প': 79,
101
+ 'ন্দ': 80,
102
+ 'ন্ধ': 81,
103
+ 'ম্ম': 82,
104
+ 'ন্ঠ': 83,
105
+ }
106
+
107
+ ekush_mappings = {
108
+ 'অ': 0,
109
+ 'আ': 1,
110
+ 'ই': 2,
111
+ 'ঈ': 3,
112
+ 'উ': 4,
113
+ 'ঊ': 5,
114
+ 'ঋ': 6,
115
+ 'এ': 7,
116
+ 'ঐ': 8,
117
+ 'ও': 9,
118
+ 'ঔ': 10,
119
+ 'ক': 11,
120
+ 'খ': 12,
121
+ 'গ': 13,
122
+ 'ঘ': 14,
123
+ 'ঙ': 15,
124
+ 'চ': 16,
125
+ 'ছ': 17,
126
+ 'জ': 18,
127
+ 'ঝ': 19,
128
+ 'ঞ': 20,
129
+ 'ট': 21,
130
+ 'ঠ': 22,
131
+ 'ড': 23,
132
+ 'ঢ': 24,
133
+ 'ণ': 25,
134
+ 'ত': 26,
135
+ 'থ': 27,
136
+ 'দ': 28,
137
+ 'ধ': 29,
138
+ 'ন': 30,
139
+ 'প': 31,
140
+ 'ফ': 32,
141
+ 'ব': 33,
142
+ 'ভ': 34,
143
+ 'ম': 35,
144
+ 'য': 36,
145
+ 'র': 37,
146
+ 'ল': 38,
147
+ 'শ': 39,
148
+ 'ষ': 40,
149
+ 'স': 41,
150
+ 'হ': 42,
151
+ 'ড়': 43,
152
+ 'ঢ়': 44,
153
+ 'য়': 45,
154
+ 'ৎ': 46,
155
+ 'ং': 47,
156
+ 'ঃ': 48,
157
+ 'ঁ': 49,
158
+ 'ব্দ': 50,
159
+ 'ঙ্গ': 51,
160
+ 'স্ক': 52,
161
+ 'স্ফ': 53,
162
+ 'চ্ছ': 54,
163
+ 'স্থ': 55,
164
+ 'ক্ত': 56,
165
+ 'স্ন': 57,
166
+ 'ষ্ণ': 58,
167
+ 'ম্প': 59,
168
+ 'প্ত': 60,
169
+ 'ম্ব': 61,
170
+ 'ত্থ': 62,
171
+ 'দ্ভ': 63,
172
+ 'ষ্ঠ': 64,
173
+ 'ল্প': 65,
174
+ 'ষ্প': 66,
175
+ 'ন্দ': 67,
176
+ 'ন্ধ': 68,
177
+ 'স্ম': 69,
178
+ 'ণ্ঠ': 70,
179
+ 'স্ত': 71,
180
+ 'ষ্ট': 72,
181
+ 'ন্ম': 73,
182
+ 'ত্ত': 74,
183
+ 'ঙ্খ': 75,
184
+ 'ত্ন': 76,
185
+ 'ন্ড': 77,
186
+ 'জ্ঞ': 78,
187
+ 'ড্ড': 79,
188
+ 'ক্ষ': 80,
189
+ 'দ্ব': 81,
190
+ 'চ্চ': 82,
191
+ 'ক্র': 83,
192
+ 'দ্দ': 84,
193
+ 'জ্জ': 85,
194
+ 'ক্ক': 86,
195
+ 'ন্ত': 87,
196
+ 'ক্ট': 88,
197
+ 'ঞ্চ': 89,
198
+ 'ট্ট': 90,
199
+ 'শ্চ': 91,
200
+ 'ক্স': 92,
201
+ 'জ্ব': 93,
202
+ 'ঞ্জ': 94,
203
+ 'দ্ধ': 95,
204
+ 'ন্ন': 96,
205
+ 'ঘ্ন': 97,
206
+ 'ক্ল': 98,
207
+ 'হ্ন': 99,
208
+ '০': 100,
209
+ '১': 101,
210
+ '২': 102,
211
+ '৩': 103,
212
+ '৪': 104,
213
+ '৫': 105,
214
+ '৬': 106,
215
+ '৭': 107,
216
+ '৮': 108,
217
+ '৯': 109
218
  }
219
 
220
+ cmaterdb_mappings = {
221
+ 'প্র': 0,
222
+ 'ঙ্গ': 1,
223
+ 'ক্ষ': 2,
224
+ 'ত্র': 3,
225
+ 'ন্দ': 4,
226
+ 'চ্ছ': 5,
227
+ 'ন্ত': 6,
228
+ 'ন্দ্র': 7,
229
+ 'স্ত': 8,
230
+ 'ন্তু': 9,
231
+ 'গ্র': 10,
232
+ 'স্থ': 11,
233
+ 'স্ট': 12,
234
+ 'ম্ব': 13,
235
+ 'স্ব': 14,
236
+ 'ত্ত': 15,
237
+ 'ক্ত': 16,
238
+ 'ন্ট': 17,
239
+ 'ল্প': 18,
240
+ 'ষ্ট': 19,
241
+ 'ন্ত্র': 20,
242
+ 'ক্র': 21,
243
+ 'ন্ন': 22,
244
+ 'দ্ধ': 23,
245
+ 'ন্ধ': 24,
246
+ 'ঙ্ক': 25,
247
+ 'ন্ড': 26,
248
+ 'ফ্র': 27,
249
+ 'ম্প': 28,
250
+ 'স্ক': 29,
251
+ 'জ্ঞ': 30,
252
+ 'ক্ট': 31,
253
+ 'শ্চ': 32,
254
+ 'ট্র': 33,
255
+ 'ত্ব': 34,
256
+ 'ল্ল': 35,
257
+ 'ব্র': 36,
258
+ 'ঞ্চ': 37,
259
+ 'ণ্ড': 38,
260
+ 'ক্স': 39,
261
+ 'শ্র': 40,
262
+ 'দ্র': 41,
263
+ 'স্প': 42,
264
+ 'ঞ্জ': 43,
265
+ 'ন্স': 44,
266
+ 'ম্ভ': 45,
267
+ 'শ্ব': 46,
268
+ 'ব্দ': 47,
269
+ 'শ্ন': 48,
270
+ 'প্প': 49,
271
+ 'ব্ল': 50,
272
+ 'প্ত': 51,
273
+ 'ক্ল': 52,
274
+ 'ষ্ট্র': 53,
275
+ 'দ্ব': 54,
276
+ 'ট্ট': 55,
277
+ 'গ্ল': 56,
278
+ 'ল্ট': 57,
279
+ 'ষ্ঠ': 58,
280
+ 'স্ত্র': 59,
281
+ 'প্ল': 60,
282
+ 'চ্চ': 61,
283
+ 'স্ম': 62,
284
+ 'দ্দ': 63,
285
+ 'গ্ন': 64,
286
+ 'জ্ব': 65,
287
+ 'ষ্ক': 66,
288
+ 'ত্ম': 67,
289
+ 'ড্র': 68,
290
+ 'ম্ম': 69,
291
+ 'ণ্ট': 70,
292
+ 'ম্প্র': 71,
293
+ 'প্ন': 72,
294
+ 'ন্ম': 73,
295
+ 'স্ফ': 74,
296
+ 'ল্দ': 75,
297
+ 'ত্ত্ব': 76,
298
+ 'জ্জ': 77,
299
+ 'ক্ষ্ম': 78,
300
+ 'ষ্ণ': 79,
301
+ 'ন্ব': 80,
302
+ 'ক্ক': 81,
303
+ 'ন্থ': 82,
304
+ 'ড্ড': 83,
305
+ 'ব্ব': 84,
306
+ 'ন্ট্র': 85,
307
+ 'ণ্ঠ': 86,
308
+ 'প্ট': 87,
309
+ 'স্তু': 88,
310
+ 'ধ্ব': 89,
311
+ 'হ্ণ': 90,
312
+ 'ভ্র': 91,
313
+ 'ল্ক': 92,
314
+ 'স্ল': 93,
315
+ 'হ্ন': 94,
316
+ 'ত্ন': 95,
317
+ 'ষ্ক্র': 96,
318
+ 'ঘ্র': 97,
319
+ 'দ্ভ': 98,
320
+ 'শ্ল': 99,
321
+ 'ব্ধ': 100,
322
+ 'ষ্ম': 101,
323
+ 'স্ক্র': 102,
324
+ 'ড়্গ': 103,
325
+ 'জ্জ্ব': 104,
326
+ 'শ্ম': 105,
327
+ 'দ্ম': 106,
328
+ 'ক্ব': 107,
329
+ 'ম্র': 108,
330
+ 'গ্ধ': 109,
331
+ 'ব্জ': 110,
332
+ 'স্ন': 111,
333
+ 'ন্দ্ব': 112,
334
+ 'হ্ম': 113,
335
+ 'ঙ্ঘ': 114,
336
+ 'খ্র': 115,
337
+ 'ত্থ': 116,
338
+ 'ল্ব': 117,
339
+ 'ম্ন': 118,
340
+ 'ঘ্ন': 119,
341
+ 'গ্গ': 120,
342
+ 'ক্ষ্ণ': 121,
343
+ 'গ্রু': 122,
344
+ 'চ্ছ্ব': 123,
345
+ 'ণ্ণ': 124,
346
+ 'ল্ম': 125,
347
+ 'স্র': 126,
348
+ 'ম্ল': 127,
349
+ 'ষ্প্র': 128,
350
+ 'ঞ্ঝ': 129,
351
+ 'স্প্র': 130,
352
+ 'ম্ভ্র': 131,
353
+ 'ষ্প': 132,
354
+ 'ঙ্খ': 133,
355
+ 'জ্র': 134,
356
+ 'গ্ব': 135,
357
+ 'থ্ব': 136,
358
+ 'ণ্ব': 137,
359
+ 'হ্ব': 138,
360
+ 'দ্দ্ব': 139,
361
+ 'দ্ঘ': 140,
362
+ 'ধ্র': 141,
363
+ 'হ্ল': 142,
364
+ 'গ্ম': 143,
365
+ 'ল্গ': 144,
366
+ 'স্খ': 145,
367
+ 'থ্র': 146,
368
+ 'ন্ধ্র': 147,
369
+ 'ন্দ্ব': 148,
370
+ 'ফ্ল': 149,
371
+ 'ঙ্ক্ষ': 150,
372
+ 'ণ্ম': 151,
373
+ 'ঞ্ছ': 152,
374
+ 'ম্ফ': 153,
375
+ 'হ্র': 154,
376
+ 'প্রু': 155,
377
+ 'ত্রু': 156,
378
+ 'ভ্ল': 157,
379
+ 'শ্রু': 158,
380
+ 'দ্রু': 159,
381
+ 'ঙ্ম': 160,
382
+ 'ক্ম': 161,
383
+ 'দ্গ': 162,
384
+ 'ন্ড্র': 163,
385
+ 'ট্ব': 164,
386
+ 'চ্ঞ': 165,
387
+ 'প্স': 166,
388
+ 'ল্ড': 167,
389
+ 'ষ্ফ': 168,
390
+ 'শ্ছ': 169,
391
+ 'জ্ঝ': 170,
392
+ 'স্ট্র': 171,
393
+ 'অ': 172,
394
+ 'আ': 173,
395
+ 'ই': 174,
396
+ 'ঈ': 175,
397
+ 'উ': 176,
398
+ 'ঊ': 177,
399
+ 'ঋ': 178,
400
+ 'এ': 179,
401
+ 'ঐ': 180,
402
+ 'ও': 181,
403
+ 'ঔ': 182,
404
+ 'ক': 183,
405
+ 'খ': 184,
406
+ 'গ': 185,
407
+ 'ঘ': 186,
408
+ 'ঙ': 187,
409
+ 'চ': 188,
410
+ 'ছ': 189,
411
+ 'জ': 190,
412
+ 'ঝ': 191,
413
+ 'ঞ': 192,
414
+ 'ট': 193,
415
+ 'ঠ': 194,
416
+ 'ড': 195,
417
+ 'ঢ': 196,
418
+ 'ণ': 197,
419
+ 'ত': 198,
420
+ 'থ': 199,
421
+ 'দ': 200,
422
+ 'ধ': 201,
423
+ 'ন': 202,
424
+ 'প': 203,
425
+ 'ফ': 204,
426
+ 'ব': 205,
427
+ 'ভ': 206,
428
+ 'ম': 207,
429
+ 'য': 208,
430
+ 'র': 209,
431
+ 'ল': 210,
432
+ 'শ': 211,
433
+ 'ষ': 212,
434
+ 'স': 213,
435
+ 'হ': 214,
436
+ 'ড়': 215,
437
+ 'ঢ়': 216,
438
+ 'য়': 217,
439
+ 'ৎ': 218,
440
+ 'ং': 219,
441
+ 'ঃ': 220,
442
+ 'ঁ': 221
443
+ }
444
+ character_mappings_model_wise={
445
+ "ahmedfaiyaz/OkkhorDiffusion":character_mappings,
446
+ "ahmedfaiyaz/OkkhorDiffusion-CMATERdb":cmaterdb_mappings,
447
+ "ahmedfaiyaz/OkkhorDiffusion-Ekush":ekush_mappings
448
+ }
449
+
450
+
451
+
452
+ def generate(modelname:str,input_text:str,batch_size:int,inference_steps:int):
453
  batch_size=int(batch_size)
454
  inference_steps=int(inference_steps)
455
  print(f"Generating image with label:{character_mappings[input_text]} batch size:{batch_size}")
456
+ label=int(character_mappings_model_wise[current_model][input_text])
 
457
  pipeline.embedding=torch.tensor([label])
458
  generate_image=pipeline(batch_size=batch_size,num_inference_steps=inference_steps).images
459
  return generate_image
460
 
461
 
462
+ def switch_pipeline(modelname:str):
463
+ global pipeline
464
+ pipeline = DiffusionPipeline.from_pretrained(modelname,custom_pipeline="ahmedfaiyaz/OkkhorDiffusion",embedding=torch.float16)
465
+ global current_model
466
+ current_model=modelname
467
+ return f"""
468
+ <div style="text-align: center; margin: 0 auto;">Selected model <a href="https://git.lnyan.comm/models/{modelname}">{modelname}</a></div>
469
+ """,gr.update(choices=character_mappings_model_wise[modelname])
470
+
471
 
472
  with gr.Blocks(css=css,elem_id="panel") as od_app:
473
  with gr.Column(min_width=100):
 
477
  <h1> Okkhor Diffusion </h1>
478
  </div>
479
  </div>
 
480
  """)
481
  #input panel
482
+ choosen_model=gr.HTML(f"""
483
+ <div style="text-align: center; margin: 0 auto;">Selected model <a href="https://git.lnyan.comm/models/{current_model}">{current_model}</a></div>
484
+ """)
485
  with gr.Row(elem_id="input-panel"):
486
+
487
  with gr.Column(variant="panel",scale=0,elem_id="input-panel-items"):
488
+ choose_model=gr.Dropdown(label="Select model",choices=modelnames,value=modelnames[0])
489
+ dropdown = gr.Dropdown(label="Select Character",choices=list(character_mappings_model_wise[current_model].keys()))
490
  batch_size = gr.Number(label="Batch Size", minimum=0, maximum=100)
491
  inference_steps= gr.Slider(label="Steps",value=100,minimum=100,maximum=1000,step=100)
492
+
493
  btn = gr.Button("Generate",size="sm")
494
 
495
 
 
497
  label="Generated images", show_label=False, elem_id="gallery"
498
  , columns=[10], rows=[10], object_fit="contain", height="auto",scale=1,min_width=80)
499
 
500
+ choose_model.change(fn=switch_pipeline,inputs=[choose_model],outputs=[choosen_model,dropdown])
501
+ btn.click(fn=generate,inputs=[choose_model,dropdown,batch_size,inference_steps],outputs=[gallery])
502
+
503
  if __name__=='__main__':
504
+ od_app.queue(max_size=20).launch(show_error=True)