broadfield-dev commited on
Commit
0f09667
·
verified ·
1 Parent(s): 9821e59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -5,6 +5,7 @@ from huggingface_hub import HfApi, create_repo, upload_file, login
5
  import random
6
  import string
7
  import logging
 
8
 
9
  # Configure logging
10
  logging.basicConfig(level=logging.INFO)
@@ -130,17 +131,17 @@ def create_hf_space():
130
 
131
  # Handle multi-file uploads
132
  for filename, content in files.items():
133
- content_lines = content.split("\n")
134
- content = ""
135
- for line in content_lines:
136
- content += line + "\n"
137
  # Write content to a temporary file
138
  with open(f"temp_{filename}", "w") as f:
139
  if filename.endswith(".py"):
140
  # Inject parameters into Python files if present
141
  content = f"PARAMS = {json.dumps(params)}\n\n{content}"
142
  f.write(content)
143
-
144
  # Upload to the new Space
145
  try:
146
  api.upload_file(
 
5
  import random
6
  import string
7
  import logging
8
+ import black
9
 
10
  # Configure logging
11
  logging.basicConfig(level=logging.INFO)
 
131
 
132
  # Handle multi-file uploads
133
  for filename, content in files.items():
134
+ #content_lines = content.split("\n")
135
+ #content = ""
136
+ #for line in content_lines:
137
+ # content += line + "\n"
138
  # Write content to a temporary file
139
  with open(f"temp_{filename}", "w") as f:
140
  if filename.endswith(".py"):
141
  # Inject parameters into Python files if present
142
  content = f"PARAMS = {json.dumps(params)}\n\n{content}"
143
  f.write(content)
144
+ os.system(f"black temp_{filename}")
145
  # Upload to the new Space
146
  try:
147
  api.upload_file(