File size: 3,018 Bytes
dcb53fc
 
0268b89
 
79da273
0268b89
3af1c8c
0268b89
 
 
79da273
 
 
0268b89
 
79da273
0d88658
0268b89
 
 
 
0d88658
0268b89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3af1c8c
 
0268b89
 
81edc2c
79da273
 
 
 
0268b89
 
3af1c8c
dcb53fc
f774200
 
e579fcc
 
 
f774200
e93ae5f
5d5059e
 
393eb82
e93ae5f
 
 
 
 
 
 
5d5059e
 
 
 
dcb53fc
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import gradio as gr
from video_processing import process_video
from gradio.themes.base import Base
from gradio.themes.utils import colors, fonts, sizes
from typing import Iterable

class CustomTheme(Base):
    def __init__(
        self,
        *,
        primary_hue: colors.Color | str = colors.orange,
        secondary_hue: colors.Color | str = colors.orange,
        neutral_hue: colors.Color | str = colors.gray,
        spacing_size: sizes.Size | str = sizes.spacing_md,
        radius_size: sizes.Size | str = sizes.radius_md,
        text_size: sizes.Size | str = sizes.text_md,
        font: fonts.Font | str | Iterable[fonts.Font | str] = (
            fonts.GoogleFont("Quicksand"),
            "ui-sans-serif",
            "sans-serif",
        ),
        font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
            fonts.GoogleFont("IBM Plex Mono"),
            "ui-monospace",
            "monospace",
        ),
    ):
        super().__init__(
            primary_hue=primary_hue,
            secondary_hue=secondary_hue,
            neutral_hue=neutral_hue,
            spacing_size=spacing_size,
            radius_size=radius_size,
            text_size=text_size,
            font=font,
            font_mono=font_mono,
        )
        super().set(
            body_background_fill="#ffffff",
            body_text_color="#282828",
            block_background_fill="#ffffff",
            block_title_text_color="#282828",
            block_label_text_color="#eb5726",
            button_primary_background_fill="#eb5726",
            button_primary_background_fill_hover="#ffffff",
            button_primary_text_color="#ffffff",
            button_primary_text_color_hover="#eb5726",
        )

custom_theme = CustomTheme()

def display_results(video_url, description):
    final_clip_path = process_video(video_url, description)
    if final_clip_path:
        return final_clip_path, final_clip_path
    return "No matching scene found", None

with gr.Blocks(theme=custom_theme) as demo:
    with gr.Column():
        gr.Markdown("# Sickstadium AI", elem_classes="centered-markdown")
        gr.Markdown("### This is a brief description for the webpage.", elem_classes="centered-markdown")
        
        gr.Markdown("### <span style='color:#ffffff'>Video URL or Filepath</span>", elem_classes="centered-markdown")
        video_url = gr.Textbox(label="", elem_id="video_url")
        
        gr.Markdown("### <span style='color:#eb5726'>Description of desired clip</span>", elem_classes="centered-markdown")
        description = gr.Textbox(label="", elem_id="description")
        
        submit_button = gr.Button("Process Video", elem_id="submit_button")
        video_output = gr.Video(label="Processed Video", elem_id="video_output")
        download_output = gr.File(label="Download Processed Video", elem_id="download_output")
        submit_button.click(fn=display_results, inputs=[video_url, description], outputs=[video_output, download_output])

demo.launch()