Linaqruf commited on
Commit
2489bda
Β·
verified Β·
1 Parent(s): 0b5a71c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -22,6 +22,9 @@ import queue
22
  import time
23
  import re
24
 
 
 
 
25
  # Regex to match ANSI escape codes (like [A, [2K, etc.)
26
  ANSI_ESCAPE = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
27
 
@@ -100,7 +103,7 @@ class MigrationTool:
100
  try:
101
  api.login(token)
102
  except Exception as login_error:
103
- return False, f"βœ— ModelScope Login failed: {str(login_error)}\n\nπŸ’‘ Tip: Ensure you are using an 'SDK Token' from https://www.modelscope.cn (NOT modelscope.ai). The token usually starts with 'ms-'."
104
 
105
  # Map license types
106
  license_map = {
@@ -370,7 +373,7 @@ class MigrationTool:
370
  if results["success"]:
371
  update_progress(1.0, desc="Completed")
372
  final_status += f"\n\nβœ… Migration completed successfully!"
373
- final_status += f"\nYour {repo_type} is available at: https://www.modelscope.cn/models/{ms_repo_id}"
374
  else:
375
  update_progress(1.0, desc="Failed")
376
  final_status += f"\n\n❌ Migration failed: {results['message']}"
@@ -396,8 +399,7 @@ def create_interface():
396
 
397
  ## πŸ“‹ Instructions:
398
  1. Get your **HuggingFace token** from: https://huggingface.co/settings/tokens
399
- 2. Get your **ModelScope SDK token** from: https://www.modelscope.cn/my/myaccesstoken
400
- * **Note**: Use tokens from **modelscope.cn** (Chinese site). The international site (modelscope.ai) is not currently supported by the SDK.
401
  3. Fill in the repository details below
402
  4. Click "Start Migration"
403
  """)
@@ -414,8 +416,8 @@ def create_interface():
414
  ms_token = gr.Textbox(
415
  label="ModelScope Token",
416
  type="password",
417
- placeholder="Enter your ModelScope SDK token",
418
- info="Use your SDK token from modelscope.cn (usually starts with 'ms-')"
419
  )
420
 
421
  with gr.Column():
@@ -507,9 +509,9 @@ def create_interface():
507
 
508
  ### πŸ”— Resources:
509
  - [HuggingFace Hub](https://huggingface.co/)
510
- - [ModelScope](https://www.modelscope.cn/)
511
  - [HuggingFace Token Settings](https://huggingface.co/settings/tokens)
512
- - [ModelScope Token Settings](https://www.modelscope.cn/my/myaccesstoken)
513
  """)
514
 
515
  return app
 
22
  import time
23
  import re
24
 
25
+ # Set ModelScope domain to use the international site
26
+ os.environ.setdefault("MODELSCOPE_DOMAIN", "modelscope.ai")
27
+
28
  # Regex to match ANSI escape codes (like [A, [2K, etc.)
29
  ANSI_ESCAPE = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
30
 
 
103
  try:
104
  api.login(token)
105
  except Exception as login_error:
106
+ return False, f"βœ— ModelScope Login failed: {str(login_error)}\n\nπŸ’‘ Tip: Ensure you are using an 'SDK Token' from https://www.modelscope.ai/my/myaccesstoken. The token usually starts with 'ms-'."
107
 
108
  # Map license types
109
  license_map = {
 
373
  if results["success"]:
374
  update_progress(1.0, desc="Completed")
375
  final_status += f"\n\nβœ… Migration completed successfully!"
376
+ final_status += f"\nYour {repo_type} is available at: https://www.modelscope.ai/models/{ms_repo_id}"
377
  else:
378
  update_progress(1.0, desc="Failed")
379
  final_status += f"\n\n❌ Migration failed: {results['message']}"
 
399
 
400
  ## πŸ“‹ Instructions:
401
  1. Get your **HuggingFace token** from: https://huggingface.co/settings/tokens
402
+ 2. Get your **ModelScope SDK token** from: https://www.modelscope.ai/my/myaccesstoken
 
403
  3. Fill in the repository details below
404
  4. Click "Start Migration"
405
  """)
 
416
  ms_token = gr.Textbox(
417
  label="ModelScope Token",
418
  type="password",
419
+ placeholder="ms_...",
420
+ info="Your SDK token from modelscope.ai (usually starts with 'ms-')"
421
  )
422
 
423
  with gr.Column():
 
509
 
510
  ### πŸ”— Resources:
511
  - [HuggingFace Hub](https://huggingface.co/)
512
+ - [ModelScope](https://www.modelscope.ai/)
513
  - [HuggingFace Token Settings](https://huggingface.co/settings/tokens)
514
+ - [ModelScope Token Settings](https://www.modelscope.ai/my/myaccesstoken)
515
  """)
516
 
517
  return app