Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -124,31 +124,6 @@ def create_and_push(space_type, hardware, private_space, other_model_name, radio
|
|
| 124 |
# 5. Delete the app.py file
|
| 125 |
os.remove("app.py")
|
| 126 |
|
| 127 |
-
# Hacking for hackathon. Revert to old gradio version in README.md
|
| 128 |
-
readme_file_path = hf_hub_download(repo_id=model_id,
|
| 129 |
-
filename="README.md",
|
| 130 |
-
repo_type="space",
|
| 131 |
-
token=token
|
| 132 |
-
)
|
| 133 |
-
with open(readme_file_path, "r") as f:
|
| 134 |
-
readme_content = f.read()
|
| 135 |
-
new_content = ""
|
| 136 |
-
for line in readme_content.split("\n"):
|
| 137 |
-
if "sdk_version" in line:
|
| 138 |
-
new_content+="sdk_version: 3.10.1\n"
|
| 139 |
-
else:
|
| 140 |
-
new_content+=line+"\n"
|
| 141 |
-
#readme_content.replace("sdk_version: 3.16.1", "sdk_version: 3.10.1")
|
| 142 |
-
with open(readme_file_path, "w") as f:
|
| 143 |
-
f.write(new_content)
|
| 144 |
-
api.upload_file(
|
| 145 |
-
path_or_fileobj=readme_file_path,
|
| 146 |
-
path_in_repo="README.md",
|
| 147 |
-
repo_id=model_id,
|
| 148 |
-
token=token,
|
| 149 |
-
repo_type="space",
|
| 150 |
-
)
|
| 151 |
-
|
| 152 |
return f"""Successfully created space at: <a href="{repo_url}" target="_blank">{repo_url}</a>"""
|
| 153 |
|
| 154 |
except Exception as e:
|
|
|
|
| 124 |
# 5. Delete the app.py file
|
| 125 |
os.remove("app.py")
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
return f"""Successfully created space at: <a href="{repo_url}" target="_blank">{repo_url}</a>"""
|
| 128 |
|
| 129 |
except Exception as e:
|