Spaces:
Runtime error
Runtime error
# Launch AIM | |
import subprocess | |
import os | |
from huggingface_hub import hf_hub_download | |
import gradio as gr | |
import time | |
PORT = 8888 | |
HOST = "0.0.0.0" | |
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}" | |
style=" | |
position: fixed; | |
top: 0px; | |
bottom: 0px; | |
right: 0px; | |
width: 100%; | |
border: none; | |
margin: 0; | |
padding: 0; | |
overflow: hidden; | |
z-index: 999999; | |
height: 100%; | |
"> | |
</iframe> | |
""" | |
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() | |