File size: 1,096 Bytes
e12b49b
 
 
 
 
 
26cd3ca
e12b49b
fe6a62c
22f0c18
e12b49b
 
 
 
 
f013d9f
e12b49b
 
 
30bfef0
e12b49b
ed3ad73
e12b49b
 
f655f7f
26cd3ca
e12b49b
 
12c80c9
a049e29
7326971
 
 
 
 
 
12c80c9
 
 
 
 
 
 
 
 
 
 
 
e12b49b
 
 
dec76c4
 
 
e12b49b
 
26cd3ca
e12b49b
 
c60f7be
f013d9f
e12b49b
 
22f0c18
e12b49b
 
 
 
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
# Launch AIM

import subprocess
import os
from huggingface_hub import hf_hub_download
import gradio as gr
import time

PORT = 443
HOST = "localhost"

REPO_ID = "muellerzr/bert-base-cased-tpu-accelerate-experiments"

def download_logs():
    filename = "aim_logs.zip"
    f = hf_hub_download(
        repo_id=REPO_ID,
        repo_type="model",
        filename=filename,
        cache_dir = "."
    )
    subprocess.run(f"unzip {f}".split())

def run_aim():
    cmd = f"aim up --host {HOST} --port {PORT}".split()
    subprocess.Popen(cmd)

html = f"""
<iframe 
    src="http://{HOST}:{PORT}"
  ">
</iframe>
"""

"""

    style="
    position: fixed;
    top: 0px;
    bottom: 0px;
    right: 0px;
    width: 100%;
    border: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    z-index: 999999;
    height: 100%;
"""

def run():
    print("Starting server....")

def main():
    download_logs()
    run_aim()
    time.sleep(5)
    demo = gr.Interface(
        fn=run, 
        inputs=[],
        outputs=gr.HTML(html),
    )

    demo.launch()

if __name__ == "__main__":
    main()