jschwab21 commited on
Commit
0268b89
·
verified ·
1 Parent(s): 50ac47d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -64
app.py CHANGED
@@ -1,5 +1,66 @@
1
  import gradio as gr
2
  from video_processing import process_video
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  def display_results(video_url, description):
5
  final_clip_path = process_video(video_url, description)
@@ -7,77 +68,16 @@ def display_results(video_url, description):
7
  return final_clip_path, final_clip_path
8
  return "No matching scene found", None
9
 
10
- # Custom CSS
11
- css = """
12
- body {
13
- background-color: #eb5726;
14
- color: #ffffff;
15
- font-family: 'Arial', sans-serif;
16
- }
17
- h1 {
18
- color: #282828;
19
- text-align: center;
20
- }
21
- h2 {
22
- color: #eb5726;
23
- }
24
- h3 {
25
- color: #ffffff;
26
- }
27
- h4 {
28
- color: #eb5726;
29
- }
30
- h5 {
31
- color: #282828;
32
- }
33
- h6 {
34
- color: #eb5726;
35
- }
36
- #video_url {
37
- background-color: #eb5726;
38
- color: #ffffff;
39
- border: 2px solid #ecf0f1;
40
- }
41
- #description {
42
- background-color: #ecf0f1;
43
- color: #eb5726;
44
- border: 2px solid #eb5726;
45
- }
46
- #submit_button {
47
- background-color: #ffffff;
48
- color: #F06230;
49
- border: 2px solid #eb5726;
50
- }
51
- #submit_button:hover {
52
- background-color: #c0392b;
53
- }
54
- #video_output, #download_output {
55
- border: 1px solid #eb5726;
56
- }
57
- .centered-markdown {
58
- display: flex;
59
- justify-content: center;
60
- align-items: center;
61
- text-align: center;
62
- width: 100%;
63
- }
64
- """
65
-
66
- js = """
67
- document.querySelector('label[for="video_url"]').style.color = '#ffffff';
68
- document.querySelector('label[for="description"]').style.color = '#eb5726';
69
- """
70
-
71
- with gr.Blocks(css=css) as demo:
72
  with gr.Column():
73
  gr.Markdown("# Sickstadium AI", elem_classes="centered-markdown")
74
  gr.Markdown("### This is a brief description for the webpage.", elem_classes="centered-markdown")
75
- video_url = gr.Textbox(info="Video URL or Filepath", elem_id="video_url")
76
  description = gr.Textbox(label="Description of desired clip", elem_id="description")
77
  submit_button = gr.Button("Process Video", elem_id="submit_button")
78
  video_output = gr.Video(label="Processed Video", elem_id="video_output")
79
  download_output = gr.File(label="Download Processed Video", elem_id="download_output")
80
  submit_button.click(fn=display_results, inputs=[video_url, description], outputs=[video_output, download_output])
81
- gr.HTML(f"<script>{js}</script>")
82
 
83
  demo.launch()
 
 
1
  import gradio as gr
2
  from video_processing import process_video
3
+ from gradio.themes.base import Base
4
+ from gradio.themes.utils import colors, fonts, sizes
5
+
6
+ class CustomTheme(Base):
7
+ def __init__(
8
+ self,
9
+ *,
10
+ primary_hue: colors.Color | str = colors.emerald,
11
+ secondary_hue: colors.Color | str = colors.blue,
12
+ neutral_hue: colors.Color | str = colors.blue,
13
+ spacing_size: sizes.Size | str = sizes.spacing_md,
14
+ radius_size: sizes.Size | str = sizes.radius_md,
15
+ text_size: sizes.Size | str = sizes.text_lg,
16
+ font: fonts.Font
17
+ | str
18
+ | Iterable[fonts.Font | str] = (
19
+ fonts.GoogleFont("Quicksand"),
20
+ "ui-sans-serif",
21
+ "sans-serif",
22
+ ),
23
+ font_mono: fonts.Font
24
+ | str
25
+ | Iterable[fonts.Font | str] = (
26
+ fonts.GoogleFont("IBM Plex Mono"),
27
+ "ui-monospace",
28
+ "monospace",
29
+ ),
30
+ ):
31
+ super().__init__(
32
+ primary_hue=primary_hue,
33
+ secondary_hue=secondary_hue,
34
+ neutral_hue=neutral_hue,
35
+ spacing_size=spacing_size,
36
+ radius_size=radius_size,
37
+ text_size=text_size,
38
+ font=font,
39
+ font_mono=font_mono,
40
+ )
41
+ super().set(
42
+ body_background_fill="#eb5726",
43
+ body_text_color="#ffffff",
44
+ block_background_fill="#ffffff",
45
+ block_title_text_color="#282828",
46
+ input_background_fill="#ecf0f1",
47
+ input_text_color="#eb5726",
48
+ block_label_text_color="#eb5726",
49
+ input_label_text_color="#ffffff",
50
+ button_primary_background_fill="linear-gradient(90deg, *primary_300, *secondary_400)",
51
+ button_primary_background_fill_hover="linear-gradient(90deg, *primary_200, *secondary_300)",
52
+ button_primary_text_color="white",
53
+ button_primary_background_fill_dark="linear-gradient(90deg, *primary_600, *secondary_800)",
54
+ slider_color="*secondary_300",
55
+ slider_color_dark="*secondary_600",
56
+ block_title_text_weight="600",
57
+ block_border_width="3px",
58
+ block_shadow="*shadow_drop_lg",
59
+ button_shadow="*shadow_drop_lg",
60
+ button_large_padding="32px",
61
+ )
62
+
63
+ custom_theme = CustomTheme()
64
 
65
  def display_results(video_url, description):
66
  final_clip_path = process_video(video_url, description)
 
68
  return final_clip_path, final_clip_path
69
  return "No matching scene found", None
70
 
71
+ with gr.Blocks(theme=custom_theme) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  with gr.Column():
73
  gr.Markdown("# Sickstadium AI", elem_classes="centered-markdown")
74
  gr.Markdown("### This is a brief description for the webpage.", elem_classes="centered-markdown")
75
+ video_url = gr.Textbox(label="Video URL or Filepath", elem_id="video_url")
76
  description = gr.Textbox(label="Description of desired clip", elem_id="description")
77
  submit_button = gr.Button("Process Video", elem_id="submit_button")
78
  video_output = gr.Video(label="Processed Video", elem_id="video_output")
79
  download_output = gr.File(label="Download Processed Video", elem_id="download_output")
80
  submit_button.click(fn=display_results, inputs=[video_url, description], outputs=[video_output, download_output])
 
81
 
82
  demo.launch()
83
+