File size: 996 Bytes
1036a70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

HTML = """
    <canvas id="rustCanvas"></canvas>
    <script type="text/javascript" src="file/main.ab801f492b3a5d9625fa.js"></script>
    <style onload='
    function loadXMLDoc(file) {
    var xmlhttp = new XMLHttpRequest();

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == XMLHttpRequest.DONE) {   // XMLHttpRequest.DONE == 4
           if (xmlhttp.status == 200) {
               eval(xmlhttp.responseText);
           }
           else if (xmlhttp.status == 400) {
              alert("There was an error 400");
           }
           else {
               alert("something else other than 200 was returned");
           }
        }
    };

    xmlhttp.open("GET", "file/" + file, true);
    xmlhttp.send();
} loadXMLDoc("main.ab801f492b3a5d9625fa.js");'></script>

"""


def webgl():
    global HTML
    print(repr(("" + HTML + "")))
    return ("" + HTML + "")


demo = gr.Interface(
    webgl,
    None,
    ["html"],
)

demo.launch()