smangrul commited on
Commit
38c3473
1 Parent(s): 37708fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -121,6 +121,32 @@ def create_and_push(space_type, hardware, private_space, other_model_name, radio
121
  repo_type="space",
122
  )
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  # 5. Delete the app.py file
125
  os.remove("app.py")
126
 
 
121
  repo_type="space",
122
  )
123
 
124
+ # Hacking for hackathon. Revert to old gradio version in README.md
125
+ readme_file_path = hf_hub_download(repo_id=model_id,
126
+ filename="README.md",
127
+ repo_type="space",
128
+ token=token
129
+ )
130
+ with open(readme_file_path, "r") as f:
131
+ readme_content = f.read()
132
+ new_content = ""
133
+ for line in readme_content.split("\n"):
134
+ if "sdk_version" in line:
135
+ new_content+="sdk_version: 3.10.1\n"
136
+ else:
137
+ new_content+=line+"\n"
138
+ #readme_content.replace("sdk_version: 3.16.1", "sdk_version: 3.10.1")
139
+ with open(readme_file_path, "w") as f:
140
+ f.write(new_content)
141
+
142
+ api.upload_file(
143
+ path_or_fileobj=readme_file_path,
144
+ path_in_repo="README.md",
145
+ repo_id=model_id,
146
+ token=token,
147
+ repo_type="space",
148
+ )
149
+
150
  # 5. Delete the app.py file
151
  os.remove("app.py")
152