Update app.py
Browse files
app.py
CHANGED
|
@@ -1,33 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
def run():
|
| 2 |
print("Starting server....")
|
| 3 |
-
|
| 4 |
-
html = f"""
|
| 5 |
-
<iframe
|
| 6 |
-
src="http://{HOST}:{PORT}"
|
| 7 |
-
style="
|
| 8 |
-
position: fixed;
|
| 9 |
-
top: 0px;
|
| 10 |
-
bottom: 0px;
|
| 11 |
-
right: 0px;
|
| 12 |
-
width: 100%;
|
| 13 |
-
border: none;
|
| 14 |
-
margin: 0;
|
| 15 |
-
padding: 0;
|
| 16 |
-
overflow: hidden;
|
| 17 |
-
z-index: 999999;
|
| 18 |
-
height: 100%;
|
| 19 |
-
">
|
| 20 |
-
</iframe>
|
| 21 |
-
"""
|
| 22 |
|
| 23 |
def main():
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
outputs=gr.HTML(html),
|
| 28 |
-
)
|
| 29 |
-
|
| 30 |
-
demo.launch()
|
| 31 |
|
| 32 |
if __name__ == "__main__":
|
| 33 |
-
main()
|
|
|
|
|
|
| 1 |
+
# Launch AIM
|
| 2 |
+
|
| 3 |
+
import subprocess
|
| 4 |
+
import os
|
| 5 |
+
from huggingface_hub import hf_hub_download
|
| 6 |
+
import gradio as gr
|
| 7 |
+
import time
|
| 8 |
+
|
| 9 |
+
PORT = 7860
|
| 10 |
+
HOST = "localhost"
|
| 11 |
+
|
| 12 |
+
REPO_ID = "muellerzr/bert-base-cased-tpu-accelerate-experiments"
|
| 13 |
+
|
| 14 |
+
def download_logs():
|
| 15 |
+
filename = "aim_logs.zip"
|
| 16 |
+
f = hf_hub_download(
|
| 17 |
+
repo_id=REPO_ID,
|
| 18 |
+
repo_type="model",
|
| 19 |
+
filename=filename,
|
| 20 |
+
cache_dir = "."
|
| 21 |
+
)
|
| 22 |
+
subprocess.run(f"unzip {f}".split())
|
| 23 |
+
|
| 24 |
+
def run_aim():
|
| 25 |
+
cmd = f"aim up --host {HOST} --port {PORT}".split()
|
| 26 |
+
subprocess.Popen(cmd)
|
| 27 |
+
|
| 28 |
def run():
|
| 29 |
print("Starting server....")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
def main():
|
| 32 |
+
download_logs()
|
| 33 |
+
run_aim()
|
| 34 |
+
time.sleep(5)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
if __name__ == "__main__":
|
| 37 |
+
main()
|
| 38 |
+
|