Spaces:
Runtime error
Runtime error
jhj0517
commited on
Commit
•
10d86f5
1
Parent(s):
abf1332
Update html
Browse files- app.py +8 -1
- modules/html_constants.py +23 -3
app.py
CHANGED
@@ -5,6 +5,7 @@ from typing import List, Dict, Optional, Union
|
|
5 |
import os
|
6 |
import yaml
|
7 |
|
|
|
8 |
from modules.sam_inference import SamInference
|
9 |
from modules.model_downloader import DEFAULT_MODEL_TYPE
|
10 |
from modules.paths import (OUTPUT_DIR, OUTPUT_PSD_DIR, SAM2_CONFIGS_DIR, TEMP_DIR, OUTPUT_FILTER_DIR, MODELS_DIR)
|
@@ -17,8 +18,11 @@ from modules.video_utils import get_frames_from_dir
|
|
17 |
class App:
|
18 |
def __init__(self,
|
19 |
args: argparse.Namespace):
|
20 |
-
self.demo = gr.Blocks()
|
21 |
self.args = args
|
|
|
|
|
|
|
|
|
22 |
self.sam_inf = SamInference(
|
23 |
model_dir=self.args.model_dir,
|
24 |
output_dir=self.args.output_dir
|
@@ -96,6 +100,8 @@ class App:
|
|
96 |
_mask_hparams = self.default_hparams["mask_hparams"]
|
97 |
|
98 |
with self.demo:
|
|
|
|
|
99 |
with gr.Tabs():
|
100 |
with gr.TabItem("Layer Divider"):
|
101 |
with gr.Row():
|
@@ -210,6 +216,7 @@ if __name__ == "__main__":
|
|
210 |
help='Whether to automatically start Gradio app or not')
|
211 |
parser.add_argument('--share', type=bool, default=False, nargs='?', const=True,
|
212 |
help='Whether to create a public link for the app or not')
|
|
|
213 |
args = parser.parse_args()
|
214 |
|
215 |
demo = App(args=args)
|
|
|
5 |
import os
|
6 |
import yaml
|
7 |
|
8 |
+
from modules.html_constants import (HEADER, DEFAULT_THEME, CSS)
|
9 |
from modules.sam_inference import SamInference
|
10 |
from modules.model_downloader import DEFAULT_MODEL_TYPE
|
11 |
from modules.paths import (OUTPUT_DIR, OUTPUT_PSD_DIR, SAM2_CONFIGS_DIR, TEMP_DIR, OUTPUT_FILTER_DIR, MODELS_DIR)
|
|
|
18 |
class App:
|
19 |
def __init__(self,
|
20 |
args: argparse.Namespace):
|
|
|
21 |
self.args = args
|
22 |
+
self.demo = gr.Blocks(
|
23 |
+
theme=self.args.theme,
|
24 |
+
css=CSS
|
25 |
+
)
|
26 |
self.sam_inf = SamInference(
|
27 |
model_dir=self.args.model_dir,
|
28 |
output_dir=self.args.output_dir
|
|
|
100 |
_mask_hparams = self.default_hparams["mask_hparams"]
|
101 |
|
102 |
with self.demo:
|
103 |
+
md_header = gr.Markdown(HEADER, elem_id="md_header")
|
104 |
+
|
105 |
with gr.Tabs():
|
106 |
with gr.TabItem("Layer Divider"):
|
107 |
with gr.Row():
|
|
|
216 |
help='Whether to automatically start Gradio app or not')
|
217 |
parser.add_argument('--share', type=bool, default=False, nargs='?', const=True,
|
218 |
help='Whether to create a public link for the app or not')
|
219 |
+
parser.add_argument('--theme', type=str, default=DEFAULT_THEME, help='Gradio Blocks theme')
|
220 |
args = parser.parse_args()
|
221 |
|
222 |
demo = App(args=args)
|
modules/html_constants.py
CHANGED
@@ -1,5 +1,25 @@
|
|
1 |
-
DEFAULT_THEME =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
GITHUB_LINK = """
|
4 |
-
## [sam2-playground](https://github.com/jhj0517/Whsiper-WebUI)
|
5 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
DEFAULT_THEME = None
|
2 |
+
|
3 |
+
HEADER = """
|
4 |
+
## [sam2-playground](https://github.com/jhj0517/sam2-playground)
|
5 |
+
|
6 |
+
<div>
|
7 |
+
<a href="">
|
8 |
+
<img src="https://img.shields.io/badge/GitHub-Wiki-blue?logo=github" alt="Github Wiki" style="display:inline-block;">
|
9 |
+
</a>
|
10 |
+
<a href="">
|
11 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Colab" style="display:inline-block;">
|
12 |
+
</a>
|
13 |
+
</div>
|
14 |
|
|
|
|
|
15 |
"""
|
16 |
+
|
17 |
+
CSS = """
|
18 |
+
#md_header a {
|
19 |
+
color: black;
|
20 |
+
text-decoration: none;
|
21 |
+
}
|
22 |
+
#md_header a:hover {
|
23 |
+
text-decoration: underline;
|
24 |
+
}
|
25 |
+
"""
|