grlll commited on
Commit
2b48fff
Β·
1 Parent(s): 125e9bf

fix index issue

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -57,7 +57,7 @@ def create_interface():
57
  return "❌ Please enter a project name!"
58
 
59
  try:
60
- if progress:
61
  progress(0.1, desc="πŸ” Authenticating...")
62
  # Use the OAuth token
63
  token = oauth_token.token
@@ -74,7 +74,7 @@ def create_interface():
74
  dataset_repo_id = f"{username}/{project_name}-data"
75
  space_repo_id = f"{username}/{project_name}-mcp"
76
 
77
- if progress:
78
  progress(0.2, desc="πŸ” Checking repository availability...")
79
  # Check if repositories already exist
80
  try:
@@ -89,7 +89,7 @@ def create_interface():
89
  except RepositoryNotFoundError:
90
  pass
91
 
92
- if progress:
93
  progress(0.3, desc="πŸ“Š Creating private dataset...")
94
  # Create the private dataset
95
  dataset_url = create_repo(
@@ -99,7 +99,7 @@ def create_interface():
99
  token=token
100
  )
101
 
102
- if progress:
103
  progress(0.4, desc="πŸ“€ Uploading export.xml...")
104
  # Upload the export.xml file (first commit)
105
  api.upload_file(
@@ -111,7 +111,7 @@ def create_interface():
111
  commit_message="Initial upload: export.xml"
112
  )
113
 
114
- if progress:
115
  progress(0.5, desc="πŸ“ Creating dataset documentation...")
116
  # Create README for dataset
117
  dataset_readme = f"""# Apple Health Data
@@ -137,7 +137,7 @@ This dataset is private and contains personal health information. Do not share a
137
  token=token
138
  )
139
 
140
- if progress:
141
  progress(0.6, desc="πŸš€ Creating MCP server space...")
142
  # Create the MCP server space
143
  space_url = create_repo(
@@ -148,7 +148,7 @@ This dataset is private and contains personal health information. Do not share a
148
  token=token
149
  )
150
 
151
- if progress:
152
  progress(0.7, desc="πŸ“¦ Uploading MCP server code...")
153
  # Read MCP server code from mcp_server.py
154
  with open('mcp_server.py', 'r') as f:
@@ -163,7 +163,7 @@ This dataset is private and contains personal health information. Do not share a
163
  token=token
164
  )
165
 
166
- if progress:
167
  progress(0.8, desc="πŸ“š Uploading parser dependencies...")
168
  # Upload parser dependencies for auto-parsing functionality
169
  api.upload_file(
@@ -198,7 +198,7 @@ This dataset is private and contains personal health information. Do not share a
198
  token=token
199
  )
200
 
201
- if progress:
202
  progress(0.85, desc="πŸ“‹ Creating requirements...")
203
  # Create requirements.txt for the space
204
  requirements_content = """gradio>=5.34.0
@@ -217,7 +217,7 @@ tqdm>=4.64.0
217
  token=token
218
  )
219
 
220
- if progress:
221
  progress(0.9, desc="πŸ”§ Configuring environment variables...")
222
  # Create space variables for the dataset repo ID
223
  api.add_space_variable(
@@ -227,7 +227,7 @@ tqdm>=4.64.0
227
  token=token
228
  )
229
 
230
- if progress:
231
  progress(0.95, desc="πŸ” Setting up secure access...")
232
  # Add the token as a secret for dataset access
233
  api.add_space_secret(
@@ -237,7 +237,7 @@ tqdm>=4.64.0
237
  token=token
238
  )
239
 
240
- if progress:
241
  progress(1.0, desc="βœ… Complete!")
242
  return f"""βœ… Successfully created your Private Apple Health Dataset and MCP Server!
243
 
 
57
  return "❌ Please enter a project name!"
58
 
59
  try:
60
+ if progress is not None:
61
  progress(0.1, desc="πŸ” Authenticating...")
62
  # Use the OAuth token
63
  token = oauth_token.token
 
74
  dataset_repo_id = f"{username}/{project_name}-data"
75
  space_repo_id = f"{username}/{project_name}-mcp"
76
 
77
+ if progress is not None:
78
  progress(0.2, desc="πŸ” Checking repository availability...")
79
  # Check if repositories already exist
80
  try:
 
89
  except RepositoryNotFoundError:
90
  pass
91
 
92
+ if progress is not None:
93
  progress(0.3, desc="πŸ“Š Creating private dataset...")
94
  # Create the private dataset
95
  dataset_url = create_repo(
 
99
  token=token
100
  )
101
 
102
+ if progress is not None:
103
  progress(0.4, desc="πŸ“€ Uploading export.xml...")
104
  # Upload the export.xml file (first commit)
105
  api.upload_file(
 
111
  commit_message="Initial upload: export.xml"
112
  )
113
 
114
+ if progress is not None:
115
  progress(0.5, desc="πŸ“ Creating dataset documentation...")
116
  # Create README for dataset
117
  dataset_readme = f"""# Apple Health Data
 
137
  token=token
138
  )
139
 
140
+ if progress is not None:
141
  progress(0.6, desc="πŸš€ Creating MCP server space...")
142
  # Create the MCP server space
143
  space_url = create_repo(
 
148
  token=token
149
  )
150
 
151
+ if progress is not None:
152
  progress(0.7, desc="πŸ“¦ Uploading MCP server code...")
153
  # Read MCP server code from mcp_server.py
154
  with open('mcp_server.py', 'r') as f:
 
163
  token=token
164
  )
165
 
166
+ if progress is not None:
167
  progress(0.8, desc="πŸ“š Uploading parser dependencies...")
168
  # Upload parser dependencies for auto-parsing functionality
169
  api.upload_file(
 
198
  token=token
199
  )
200
 
201
+ if progress is not None:
202
  progress(0.85, desc="πŸ“‹ Creating requirements...")
203
  # Create requirements.txt for the space
204
  requirements_content = """gradio>=5.34.0
 
217
  token=token
218
  )
219
 
220
+ if progress is not None:
221
  progress(0.9, desc="πŸ”§ Configuring environment variables...")
222
  # Create space variables for the dataset repo ID
223
  api.add_space_variable(
 
227
  token=token
228
  )
229
 
230
+ if progress is not None:
231
  progress(0.95, desc="πŸ” Setting up secure access...")
232
  # Add the token as a secret for dataset access
233
  api.add_space_secret(
 
237
  token=token
238
  )
239
 
240
+ if progress is not None:
241
  progress(1.0, desc="βœ… Complete!")
242
  return f"""βœ… Successfully created your Private Apple Health Dataset and MCP Server!
243