Support non-app.py Spaces
#2
by
Wauplin
HF staff
- opened
app.py
CHANGED
@@ -28,10 +28,9 @@ def generate(spaces):
|
|
28 |
]
|
29 |
print(space_ids)
|
30 |
for space_id in space_ids:
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
).text
|
35 |
|
36 |
input = PROMPT + f"```py{app_py}```"
|
37 |
|
|
|
28 |
]
|
29 |
print(space_ids)
|
30 |
for space_id in space_ids:
|
31 |
+
app_file = huggingface_hub.SpaceCard.load(space_id).data.get("app_file", "app.py")
|
32 |
+
with open(huggingface_hub.hf_hub_download(space_id, repo_type="space", filename=app_file)) as app_file_path:
|
33 |
+
app_py = app_file_path.read()
|
|
|
34 |
|
35 |
input = PROMPT + f"```py{app_py}```"
|
36 |
|