File size: 4,000 Bytes
3883c60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import gradio as gr
from .tabs import *

tabs_el: gr.Tabs = None


def create_ui(theme) -> gr.Blocks:

    from simplestyle.manager import create_stylesheet, SimpleStyle, StyleRule, StyleValue

    with SimpleStyle(priority=0):
        with StyleRule('.gradio-container'):
            StyleValue('max-width', 'calc(100% - 100px) !important')

        with StyleRule('.tabitem:not(.tabitem .tabitem)'):
            StyleValue('height', 'calc(100vh - 100px) !important')
            StyleValue('overflow', 'auto')

        with StyleRule('.tool'):
            StyleValue('max-width', '2.2em')
            StyleValue('min-width', '2.2em !important')
            StyleValue('height', '2.4em')
            StyleValue('align-self', 'end')
            StyleValue('line-height', '1em')
            StyleValue('border-radius', '0.5em')

        with StyleRule('.smallsplit'):
            StyleValue('max-width', '2.2em')
            StyleValue('min-width', '2.2em !important')
            StyleValue('align-self', 'end')
            StyleValue('border-radius', '0.5em')

        with StyleRule('.offset--10'):
            StyleValue('transform', 'translateY(-10px)')

        with StyleRule('.text-center'):
            StyleValue('text-align', 'center')

        with StyleRule('.padding-h-0'):
            StyleValue('padding-left', '0 !important')
            StyleValue('padding-right', '0 !important')

        with StyleRule('table:not(.file-preview)'):
            StyleValue('border', '1px solid black !important')
            StyleValue('margin-left', 'auto')
            StyleValue('margin-right', 'auto')

        with StyleRule('.dark table:not(.file-preview)'):
            StyleValue('border', '1px solid white !important')

        with StyleRule('table a'):
            StyleValue('color', 'black !important')

        with StyleRule('.dark table a'):
            StyleValue('color', 'white !important')

        with StyleRule('table th, table td'):
            StyleValue('padding', '10px !important')

        with StyleRule('.center-h'):
            StyleValue('margin-left', 'auto !important')
            StyleValue('margin-right', 'auto !important')
            StyleValue('text-align', 'center !important')

        with StyleRule('.tab-nav'):
            StyleValue('overflow-x', 'auto')
            StyleValue('overflow-y', 'hidden')
            StyleValue('flex-wrap', 'nowrap !important')
            StyleValue('white-space', 'nowrap !important')

            StyleValue('border-bottom', 'none !important')

        with StyleRule('.tabitem'):
            StyleValue('border-top', '1px solid var(--border-color-primary) !important')

        with StyleRule('.leftscroll'):
            StyleValue('border-left', '5px solid red !important')
            StyleValue('border-radius', '10px 0 0 10px')

        with StyleRule('.rightscroll'):
            StyleValue('border-right', '5px solid red !important')
            StyleValue('border-radius', '0 10px 10px 0')

        with StyleRule('.leftscroll.rightscroll'):
            StyleValue('border-radius', '10px')

    import webui.extensionlib.extensionmanager as em
    import webui.extensionlib.callbacks as cb

    for e in em.states.values():
        e.get_style_rules()

    tabs = [
        ('๐Ÿ“œโ–ถ๐Ÿ—ฃ Text to speech', text_to_speech),
        ('๐Ÿ—ฃโ–ถ๐Ÿ—ฃ RVC', rvc),
        ('๐Ÿ“œโ–ถ๐ŸŽต AudioLDM', audioldm_tab),
        ('๐Ÿ“œโ–ถ๐ŸŽต AudioCraft', audiocraft_tab),
        ('๐Ÿ—ฃโ–ถ๐Ÿ“œ Whisper', whisper),
        ('๐Ÿงจ Train', training_tab),
        ('๐Ÿ”จ Utils', utils_tab),
        ('โš™ Settings', extra_tab),
        ('๐Ÿงพ Info', info_tab)
    ]
    global tabs_el
    with gr.Blocks(theme=theme, title='๐Ÿ”ŠAudio WebUI๐ŸŽต', css=create_stylesheet()) as webui:
        with gr.Tabs() as tabs_element:
            tabs_el = tabs_element
            for name, content in tabs:
                with gr.Tab(name, id=name):
                    content()
            cb.get_manager('webui.tabs')()
    return webui