Update app.py
Browse files
app.py
CHANGED
|
@@ -34,18 +34,18 @@ def show_s(name,d_app,token):
|
|
| 34 |
file_b = open('tmp_j','r')
|
| 35 |
r_file = file_b.readlines()
|
| 36 |
spaces=[]
|
| 37 |
-
|
| 38 |
-
|
| 39 |
for line in r_file:
|
| 40 |
if "'id':" in line:
|
| 41 |
line = line.split(":",1)[1]
|
| 42 |
line = line.split("/",1)[1]
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
print(f"{line}")
|
| 46 |
-
|
| 47 |
-
spcs.close()
|
| 48 |
-
return(gr.Dropdown.update(label="Spaces", choices=[s for s in spaces])),spaces
|
| 49 |
|
| 50 |
def show_f(repo,name,token):
|
| 51 |
api = HfApi(token=token)
|
|
@@ -78,17 +78,15 @@ def repl(rs,rt,uu):
|
|
| 78 |
return r_file, f'mod_{uu}'
|
| 79 |
|
| 80 |
def get_f(r_name,spaces,token):
|
| 81 |
-
spcs=open('spc','r')
|
| 82 |
-
sfl = spcs.readlines()
|
| 83 |
api = HfApi(token=token)
|
| 84 |
spaces_b=[]
|
| 85 |
files_b=[]
|
| 86 |
-
for i in
|
| 87 |
print(f"a-{i}")
|
| 88 |
-
print(
|
| 89 |
#print(space)
|
| 90 |
-
f_ist = (api.list_repo_files(repo_id=f'{r_name}/{
|
| 91 |
-
sp =
|
| 92 |
for i in f_ist:
|
| 93 |
print("b")
|
| 94 |
r = requests.get(f'https://huggingface.co/spaces/{r_name}/{sp}/raw/main/{f_ist[i]}')
|
|
|
|
| 34 |
file_b = open('tmp_j','r')
|
| 35 |
r_file = file_b.readlines()
|
| 36 |
spaces=[]
|
| 37 |
+
spaces2=[]
|
|
|
|
| 38 |
for line in r_file:
|
| 39 |
if "'id':" in line:
|
| 40 |
line = line.split(":",1)[1]
|
| 41 |
line = line.split("/",1)[1]
|
| 42 |
+
line2 = line.replace("'","").replace(",","").replace("\n","")
|
| 43 |
+
line3 = line.replace("'","").replace(",","")
|
| 44 |
+
|
| 45 |
+
spaces2.append(line3)
|
| 46 |
+
spaces.append(line2)
|
| 47 |
print(f"{line}")
|
| 48 |
+
return(gr.Dropdown.update(label="Spaces", choices=[s for s in spaces])),spaces2
|
|
|
|
|
|
|
| 49 |
|
| 50 |
def show_f(repo,name,token):
|
| 51 |
api = HfApi(token=token)
|
|
|
|
| 78 |
return r_file, f'mod_{uu}'
|
| 79 |
|
| 80 |
def get_f(r_name,spaces,token):
|
|
|
|
|
|
|
| 81 |
api = HfApi(token=token)
|
| 82 |
spaces_b=[]
|
| 83 |
files_b=[]
|
| 84 |
+
for i in spaces:
|
| 85 |
print(f"a-{i}")
|
| 86 |
+
print(spaces[i])
|
| 87 |
#print(space)
|
| 88 |
+
f_ist = (api.list_repo_files(repo_id=f'{r_name}/{spaces[i]}', repo_type="space"))
|
| 89 |
+
sp = spaces[i]
|
| 90 |
for i in f_ist:
|
| 91 |
print("b")
|
| 92 |
r = requests.get(f'https://huggingface.co/spaces/{r_name}/{sp}/raw/main/{f_ist[i]}')
|