Update app.py
Browse files
app.py
CHANGED
@@ -1,64 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
<script>
|
4 |
-
function open_control() {
|
5 |
-
var panel = document.querySelector('#control_panel');
|
6 |
-
|
7 |
-
var split_json = []
|
8 |
-
var out_json = []
|
9 |
-
split_json = panel.classList.value.split(' ')
|
10 |
-
|
11 |
-
console.log(split_json.length)
|
12 |
-
if (split_json.length === 2 || panel.classList.value.includes(" ")) {
|
13 |
-
panel.classList.toggle('open');
|
14 |
-
console.log('clicked')
|
15 |
-
} else {
|
16 |
-
panel.classList = '.contain #control_panel'
|
17 |
-
console.log('panel is open, closing')
|
18 |
-
|
19 |
-
};
|
20 |
-
};
|
21 |
-
|
22 |
-
</script>
|
23 |
-
"""
|
24 |
-
css="""
|
25 |
-
.contain #control_panel {
|
26 |
-
position: fixed;
|
27 |
-
right: 100%;
|
28 |
-
z-index: 9999;
|
29 |
-
width: 40%;
|
30 |
-
top: 50px;
|
31 |
-
box-shadow: 0 0 12px 0px black;
|
32 |
-
transition: right 0.5s ease;
|
33 |
-
}
|
34 |
-
.contain #control_panel.open {
|
35 |
-
right: 60%;
|
36 |
-
}
|
37 |
-
#top_bar {
|
38 |
-
height: 50px;
|
39 |
-
width: 100%;
|
40 |
-
position: fixed;
|
41 |
-
background: #185991;
|
42 |
-
top: 0px;
|
43 |
-
left: 0px;
|
44 |
-
z-index: 99999;
|
45 |
-
}
|
46 |
-
#control_btn {
|
47 |
-
height: 20px;
|
48 |
-
padding: 10px;
|
49 |
-
cursor: pointer;
|
50 |
-
border-radius: 5px;
|
51 |
-
color: white;
|
52 |
-
position: fixed;
|
53 |
-
z-index: 9999999999999999;
|
54 |
-
top: 5px;
|
55 |
-
left: 10px;
|
56 |
-
background: #1e293b;
|
57 |
-
height: fit-content;
|
58 |
-
width: fit-content;
|
59 |
-
}
|
60 |
-
"""
|
61 |
-
|
62 |
with gr.Blocks(head=head,css=css) as app:
|
63 |
gr.HTML("""<div id='top_bar'><div class='control_btn' name='control_btn' id='control_btn' onclick='open_control()'>Controls</div></div>""")
|
64 |
with gr.Group(elem_id="control_panel"):
|
|
|
1 |
import gradio as gr
|
2 |
+
import gradio_sidebar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
with gr.Blocks(head=head,css=css) as app:
|
4 |
gr.HTML("""<div id='top_bar'><div class='control_btn' name='control_btn' id='control_btn' onclick='open_control()'>Controls</div></div>""")
|
5 |
with gr.Group(elem_id="control_panel"):
|