File size: 1,532 Bytes
4b286f3
e09e87e
82502f1
4b286f3
 
 
 
 
 
 
 
3b6c4d9
4b286f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<div id="KiteWindApp">
    <!-- This app was created with KiteWind Chat-assisted Web App Creator (https://huggingface.co/spaces/gstaff/KiteWind) -->
    <iframe id="demo-iframe" width="100%" height="512px" src="about:blank" frameborder="0"></iframe>
    <script>
        const template = \`<div id="root"></div>
            <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@stlite/[email protected]/build/stlite.css"/>
            <script src="https://cdn.jsdelivr.net/npm/@stlite/[email protected]/build/stlite.js"><\\\/script>
            <script>
                  const streamlitConfig = "[server]\\\\nrunOnSave = true";
                  const code = \\\`STARTING_CODE\\\`;
                  const appController = stlite.mount({
                      requirements: [STARTING_REQUIREMENTS], // Packages to install
                      entrypoint: "streamlit_app.py", // The target file of the streamlit run command
                      files: {
                        ".streamlit/config.toml": streamlitConfig,
                        "streamlit_app.py": code,
                      },
                    }, document.getElementById("root"));
                  // Returned controller functions defined here:
                  window.appController = appController;
            <\\\/script>\`
        const frame = document.getElementById('demo-iframe');
        frame.contentWindow.document.open();
        frame.contentWindow.document.write(template);
        frame.contentWindow.document.close();
    </script>
</div>