Spaces:
Running
Running
Support non-app.py Spaces (#2)
Browse files- Support non-app.py Spaces (eca073c651b69b70b9401bac6df6c18765cb7ae6)
Co-authored-by: Lucain Pouget <Wauplin@users.noreply.huggingface.co>
app.py
CHANGED
@@ -24,10 +24,9 @@ def generate(spaces):
|
|
24 |
]
|
25 |
print(space_ids)
|
26 |
for space_id in space_ids:
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
).text
|
31 |
|
32 |
input = PROMPT + f"```py{app_py}```"
|
33 |
|
|
|
24 |
]
|
25 |
print(space_ids)
|
26 |
for space_id in space_ids:
|
27 |
+
app_file = huggingface_hub.SpaceCard.load(space_id).data.get("app_file", "app.py")
|
28 |
+
with open(huggingface_hub.hf_hub_download(space_id, repo_type="space", filename=app_file)) as app_file_path:
|
29 |
+
app_py = app_file_path.read()
|
|
|
30 |
|
31 |
input = PROMPT + f"```py{app_py}```"
|
32 |
|