Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,27 +9,6 @@ import subprocess
|
|
9 |
from pathlib import Path
|
10 |
from typing import Union
|
11 |
|
12 |
-
id_rsa_file = "/content/id_rsa"
|
13 |
-
id_rsa_pub_file = "/content/id_rsa.pub"
|
14 |
-
if os.path.exists(id_rsa_file):
|
15 |
-
os.remove(id_rsa_file)
|
16 |
-
if os.path.exists(id_rsa_pub_file):
|
17 |
-
os.remove(id_rsa_pub_file)
|
18 |
-
|
19 |
-
def gen_key(path: Union[str, Path]) -> None:
|
20 |
-
path = Path(path)
|
21 |
-
arg_string = f'ssh-keygen -t rsa -b 4096 -N "" -q -f {path.as_posix()}'
|
22 |
-
args = shlex.split(arg_string)
|
23 |
-
subprocess.run(args, check=True)
|
24 |
-
path.chmod(0o600)
|
25 |
-
|
26 |
-
gen_key(id_rsa_file)
|
27 |
-
|
28 |
-
import threading
|
29 |
-
def tunnel():
|
30 |
-
!ssh -R 80:127.0.0.1:7860 -o StrictHostKeyChecking=no -i /content/id_rsa remote.moe
|
31 |
-
threading.Thread(target=tunnel, daemon=True).start()
|
32 |
-
|
33 |
import gradio as gr
|
34 |
|
35 |
def generate(prompt):
|
|
|
9 |
from pathlib import Path
|
10 |
from typing import Union
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
import gradio as gr
|
13 |
|
14 |
def generate(prompt):
|