muellerzr's picture
muellerzr HF staff
Update app.py
0fad831
raw
history blame
1.22 kB
# Launch AIM
import subprocess
import os
from huggingface_hub import hf_hub_download
import time
from pathlib import Path
import gradio as gr
PORT = 7860
HOST = "0.0.0.0"
REPO_ID = "muellerzr/bert-base-cased-tpu-accelerate-experiments"
def run_aim():
"""
filename = "aim_logs.zip"
f = hf_hub_download(
repo_id=REPO_ID,
repo_type="model",
filename=filename,
cache_dir = "."
)
"""
subprocess.run(["unzip", "test.zip"])
subprocess.run(["mv", "test/.aim/", "/home/user/app/.aim/"])
time.sleep(3)
cmd = f"aim up --port 7861 --dev --base-path /proxy/absolute/{PORT} &"
subprocess.run(cmd, shell=True)
"""
style "";
position: fixed;
top: 0px;
bottom: 0px;
right: 0px;
width: 100%;
border: none;
margin: 0;
padding: 0;
overflow: hidden;
z-index: 999999;
height: 100%;
"""
html = f"""
<iframe
src="http://127.0.0.1:7861/proxy/absolute/7860"
>
</iframe>
"""
def run():
print("Running app!")
def main():
run_aim()
time.sleep(5)
demo = gr.Interface(
fn=run,
inputs=[],
outputs=gr.HTML(html),
)
demo.launch()
if __name__ == "__main__":
main()