Spaces:
Runtime error
Runtime error
Update app_t.py
Browse files
app_t.py
CHANGED
|
@@ -1,13 +1,33 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
import git
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
from zipfile import ZipFile
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
print('Get current working directory : ', os.getcwd())
|
| 4 |
+
path=os.getcwd()
|
| 5 |
+
path=os.getcwd()+"clipseg/"
|
| 6 |
|
| 7 |
import git
|
| 8 |
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
print('working path', Path.cwd())
|
| 11 |
|
| 12 |
+
git.Git(path).clone("https://github.com/ThereforeGames/txt2mask.git")
|
| 13 |
+
|
| 14 |
+
from zipfile import ZipFile
|
| 15 |
+
#zf = ZipFile('clipseg-master.zip', 'r')
|
| 16 |
+
#zf.extractall('clipseg/')
|
| 17 |
+
#zf.close()
|
| 18 |
from zipfile import ZipFile
|
| 19 |
+
ZipFile("clipseg-master.zip").extractall("clipseg/")
|
| 20 |
+
|
| 21 |
+
import zipfile
|
| 22 |
+
def un_zipFiles(path):
|
| 23 |
+
files=os.listdir(path)
|
| 24 |
+
for file in files:
|
| 25 |
+
if file.endswith('.zip'):
|
| 26 |
+
filePath=path+'/'+file
|
| 27 |
+
zip_file = zipfile.ZipFile(filePath)
|
| 28 |
+
for names in zip_file.namelist():
|
| 29 |
+
zip_file.extract(names,path)
|
| 30 |
+
zip_file.close()
|
| 31 |
|
| 32 |
|
| 33 |
|