forked from ddPn08/Radiata
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ふぁ <[email protected]>
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from typing import * | ||
|
||
import gradio as gr | ||
import glob | ||
import os | ||
from modules.components import image_generation_options | ||
|
||
from modules import setting | ||
from modules.ui import Tab | ||
|
||
from PIL import Image | ||
|
||
|
||
class ImagesBrowser(Tab): | ||
def title(self): | ||
return "Images Browser" | ||
|
||
def sort(self): | ||
return 3 | ||
|
||
def ui(self, outlet): | ||
with gr.Column(): | ||
outputs_dir = glob.glob(os.path.join("outputs", "*")) | ||
with gr.Tabs(): | ||
for dir in outputs_dir: | ||
with gr.Tab(dir.split(os.sep)[-1]): | ||
outputs_img = glob.glob(os.path.join(dir, "*")) | ||
imgs = [f for f in outputs_img if os.path.isfile(f)] | ||
imgs_sorted = sorted(imgs, key=os.path.getmtime) | ||
gr.Gallery( | ||
value=[Image.open(img) for img in imgs_sorted] | ||
).style(columns=4) |