24
24
debug = shared .log .trace if os .environ .get ('SD_EN_DEBUG' , None ) is not None else lambda * args , ** kwargs : None
25
25
debug ('Trace: EN' )
26
26
card_full = '''
27
- <div class='card' onclick={card_click} title='{name}' data-page='{page}' data-name='{name}' data-filename='{filename}' data-short='{short}' data-tags='{tags}' data-mtime='{mtime}' data-size='{size}' data-search='{search}' style='--data-color: {color}'>
27
+ <div class='card' onclick={card_click} title='{name}' data-page='{page}' data-name='{name}' data-filename='{filename}' data-short='{short}' data-tags='{tags}' data-mtime='{mtime}' data-size='{size}' data-search='{search}' data-version='{version}' style='--data-color: {color}'>
28
28
<div class='overlay'>
29
29
<div class='name {reference}'>{title}</div>
30
30
</div>
@@ -291,6 +291,10 @@ def create_page(self, tabname, skip = False):
291
291
subdirs_html += f'<button class="lg secondary gradio-button custom-button { style } " onclick="extraNetworksSearchButton(event)">{ html .escape (subdir )} </button><br>'
292
292
self .html = ''
293
293
self .create_items (tabname )
294
+ versions = sorted ({item .get ("version" , "" ) for item in self .items if item .get ("version" )})
295
+ versions_html = ''
296
+ for ver in versions :
297
+ versions_html += f'<button class="lg secondary gradio-button custom-button" onclick="extraNetworksFilterVersion(event)" style="margin-left:4px">{ html .escape (ver )} </button><br>'
294
298
self .create_xyz_grid ()
295
299
htmls = []
296
300
@@ -314,7 +318,7 @@ def create_page(self, tabname, skip = False):
314
318
htmls .append (self .create_html (item , tabname ))
315
319
self .html += '' .join (htmls )
316
320
self .page_time = time .time ()
317
- self .html = f"<div id='{ tabname } _{ self_name_id } _subdirs' class='extra-network-subdirs'>{ subdirs_html } </div><div id='~tabname_{ self_name_id } _cards' class='extra-network-cards'>{ self .html } </div>"
321
+ self .html = f""" <div id='{ tabname } _{ self_name_id } _subdirs' class='extra-network-subdirs'>{ subdirs_html } { versions_html } </div><div id='~tabname_{ self_name_id } _cards' class='extra-network-cards'>{ self .html } </div>"" "
318
322
shared .log .debug (f'Networks: type="{ self .name } " items={ len (self .items )} subfolders={ len (subdirs )} tab={ tabname } folders={ self .allowed_directories_for_previews ()} list={ self .list_time :.2f} thumb={ self .preview_time :.2f} desc={ self .desc_time :.2f} info={ self .info_time :.2f} workers={ shared .max_workers } ' )
319
323
if len (self .missing_thumbs ) > 0 :
320
324
threading .Thread (target = self .create_thumb ).start ()
0 commit comments