Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,46 @@
|
|
1 |
import os
|
|
|
2 |
import logging
|
3 |
import re
|
4 |
-
import spaces
|
5 |
import random
|
6 |
import string
|
7 |
-
import torch
|
8 |
import requests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
import gradio as gr
|
10 |
import numpy as np
|
11 |
from lxml.html import fromstring
|
@@ -23,23 +58,6 @@ from diffusers import DiffusionPipeline, AnimateDiffPipeline, MotionAdapter, Eul
|
|
23 |
#import jax
|
24 |
#import jax.numpy as jnp
|
25 |
from pyina.launchers import TorqueMpiPool as Pool
|
26 |
-
import sys
|
27 |
-
import warnings
|
28 |
-
|
29 |
-
warnings.filterwarnings("ignore")
|
30 |
-
|
31 |
-
root = logging.getLogger()
|
32 |
-
root.setLevel(logging.DEBUG)
|
33 |
-
handler = logging.StreamHandler(sys.stdout)
|
34 |
-
handler.setLevel(logging.DEBUG)
|
35 |
-
formatter = logging.Formatter('\n >>> [%(levelname)s] %(asctime)s %(name)s: %(message)s\n')
|
36 |
-
handler.setFormatter(formatter)
|
37 |
-
root.addHandler(handler)
|
38 |
-
handler2 = logging.StreamHandler(sys.stderr)
|
39 |
-
handler2.setLevel(logging.DEBUG)
|
40 |
-
formatter = logging.Formatter('\n >>> [%(levelname)s] %(asctime)s %(name)s: %(message)s\n')
|
41 |
-
handler2.setFormatter(formatter)
|
42 |
-
root.addHandler(handler2)
|
43 |
|
44 |
last_motion=None
|
45 |
dtype = torch.float16
|
|
|
1 |
import os
|
2 |
+
import subprocess
|
3 |
import logging
|
4 |
import re
|
|
|
5 |
import random
|
6 |
import string
|
|
|
7 |
import requests
|
8 |
+
import sys
|
9 |
+
import warnings
|
10 |
+
|
11 |
+
warnings.filterwarnings("ignore")
|
12 |
+
root = logging.getLogger()
|
13 |
+
root.setLevel(logging.DEBUG)
|
14 |
+
handler = logging.StreamHandler(sys.stdout)
|
15 |
+
handler.setLevel(logging.DEBUG)
|
16 |
+
formatter = logging.Formatter('\n >>> [%(levelname)s] %(asctime)s %(name)s: %(message)s\n')
|
17 |
+
handler.setFormatter(formatter)
|
18 |
+
root.addHandler(handler)
|
19 |
+
handler2 = logging.StreamHandler(sys.stderr)
|
20 |
+
handler2.setLevel(logging.DEBUG)
|
21 |
+
formatter = logging.Formatter('\n >>> [%(levelname)s] %(asctime)s %(name)s: %(message)s\n')
|
22 |
+
handler2.setFormatter(formatter)
|
23 |
+
root.addHandler(handler2)
|
24 |
+
|
25 |
+
def cmd(cmd, assert_success=False, capture_output=False, env=None, dry_run=False):
|
26 |
+
if dry_run:
|
27 |
+
print(f"--> {cmd}")
|
28 |
+
result = 1
|
29 |
+
else:
|
30 |
+
result = subprocess.run(cmd, shell=True, capture_output=capture_output, env=env)
|
31 |
+
if assert_success and result.returncode != 0:
|
32 |
+
logging.error(
|
33 |
+
f"Command '{cmd}' failed with exit status code '{result.returncode}'. Exiting..."
|
34 |
+
)
|
35 |
+
sys.exit()
|
36 |
+
|
37 |
+
return result
|
38 |
+
|
39 |
+
cmd("sudo apt install python3-mpi4py")
|
40 |
+
cmd("")
|
41 |
+
|
42 |
+
import spaces
|
43 |
+
import torch
|
44 |
import gradio as gr
|
45 |
import numpy as np
|
46 |
from lxml.html import fromstring
|
|
|
58 |
#import jax
|
59 |
#import jax.numpy as jnp
|
60 |
from pyina.launchers import TorqueMpiPool as Pool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
last_motion=None
|
63 |
dtype = torch.float16
|