smangrul commited on
Commit
5ce0316
1 Parent(s): 93c4a18

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -125,12 +125,22 @@ def create_and_push(space_type, hardware, private_space, other_model_name, radio
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, filename="README.md")
 
 
 
 
129
  with open(readme_file_path, "r") as f:
130
  readme_content = f.read()
131
- readme_content.replace("sdk_version: 3.16.1", "sdk_version: 3.10.1")
 
 
 
 
 
 
132
  with open(readme_file_path, "w") as f:
133
- f.write(readme_content)
134
  api.upload_file(
135
  path_or_fileobj=readme_file_path,
136
  path_in_repo="README.md",
 
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
+
136
+ for line in 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",