Transformers
Inference Endpoints
File size: 2,099 Bytes
b5f0733
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import subprocess, sys, os, time, select, pty, errno

xxx = '/kaggle/working'

assu = os.path.join(xxx, 'venv.py')
os.chdir(xxx)
os.system(f'curl -sLO https://raw.githubusercontent.com/gutris1/segsmaker/main/kaggle/script/pantat88.py')
sys.path.append(xxx)
time.sleep(1)
from pantat88 import say, download
say('【{red} Installing VENV{d} 】{red}')

auuuwooo = [
    f"curl -LO https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/get_ip.py",
    f"curl -LO https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel",
    f"curl -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64",
    f"apt-get update",
    f"apt -y install lz4 pv aria2",
    f"pip install -q git+https://github.com/DEX-1101/colablib",
    f"npm install -g localtunnel",
    f"chmod +x /usr/bin/cl"]

for tarzan in auuuwooo:
    subprocess.run(tarzan.split(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

def venv_in():
    os.chdir('/kaggle')
    url = 'https://huggingface.co/pantat88/back_up/resolve/main/venv_19-6-2024.tar.lz4'
    fn = 'venv_19-6-2024.tar.lz4'
    download(url)
    
    extract_tar = f'pv {fn} | lz4 -d | tar xf -'
    ikan, asin = pty.openpty()
    proc = subprocess.Popen(extract_tar, shell=True, stdin=asin, stdout=asin, stderr=asin, close_fds=True)
    os.close(asin)
    while True:
        r, _, _ = select.select([ikan], [], [], 0.1)
        if ikan in r:
            try:
                jemuran = os.read(ikan, 1024).decode('utf-8', 'ignore')
                print(jemuran, end='')
                
            except OSError as e:
                if e.errno == errno.EIO:
                    break
                    
        if proc.poll() is not None:
            break

    proc.wait()
    os.close(ikan)
    os.remove(fn)

    oppai = '/kaggle/venv'
    os.system(f'rm -rf {os.path.join(oppai, "bin", "pip*")}')
    os.system(f'rm -rf {os.path.join(oppai, "bin", "python*")}')
    os.system(f'python -m venv {oppai}')

venv_in()
os.chdir(xxx)
say('【{red} VENV Setup Completed{d} 】{red}')
os.remove(assu)