File size: 1,862 Bytes
d40e945
 
 
 
 
35b707a
d40e945
f88842b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cc1e3ba
f88842b
d40e945
 
ed360bb
 
 
d40e945
 
f88842b
 
 
 
 
d40e945
35b707a
d40e945
 
 
 
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
import gradio as gr
from .config import *
from .messages import *
from .ui_vote import *
from .ui_leaderboard import *
from .ui_contenders import *

# JavaScript within HTML head
head_js = ""
shortcut_js = """
<script>
function shortcuts(e) {
    var event = document.all ? window.event : e;
    switch (e.target.tagName.toLowerCase()) {
        case "input":
        case "textarea":
            break;
        default:
            switch (e.key.toLowerCase()) {
                case "a":
                    document.getElementById("arena-a-better").click();
                    break;
                case "b":
                    document.getElementById("arena-b-better").click();
                    break;
                case "n":
                    document.getElementById("arena-next-round").click();
                    break;
            }
    }
}
document.addEventListener('keypress', shortcuts, false);

"""
head_js += shortcut_js
head_js += open("app/cookie.js").read()
head_js += '</script>'

with gr.Blocks() as about:
    with gr.Row():
        with gr.Accordion("News", open=False):
            gr.Markdown(NEWS)
    gr.Markdown(ABOUT)

with gr.Blocks(
    css="footer {visibility: hidden}textbox{resize:none} .blurred-text {filter: blur(0.15em);}",
    head=head_js,
    title="TTS Arena"
) as app:
    gr.Markdown(DESCR)
    gr.TabbedInterface([vote, leaderboard, about, tts_info], ['πŸ—³οΈ Vote', 'πŸ† Leaderboard', 'πŸ“„ About', 'πŸ—£ Contenders'])
    if CITATION_TEXT:
        with gr.Row():
            with gr.Accordion("Citation", open=False):
                gr.Markdown(f"If you use this data in your publication, please cite us!\n\nCopy the BibTeX citation to cite this source:\n\n```bibtext\n{CITATION_TEXT}\n```\n\nPlease note that all generated audio clips should be assumed unsuitable for redistribution or commercial use.")