civitaiarchive commited on
Commit
3a66125
·
1 Parent(s): 98f4346

Add civitai-to-hf-uploader

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -67,7 +67,14 @@ def get_files_by_model_id(model_id):
67
  output = {}
68
  for version in model['modelVersions']:
69
  for file in version['files']:
70
- output[str(model['id']) + '/' + str(version['id']) + '/' + file['name']] = file['downloadUrl']
 
 
 
 
 
 
 
71
  return output
72
 
73
  except requests.exceptions.RequestException as e:
 
67
  output = {}
68
  for version in model['modelVersions']:
69
  for file in version['files']:
70
+ output[str(model['id']) + '/' + str(version['id']) + '/' + file['name']] = {
71
+ 'downloadUrl': file['downloadUrl'],
72
+ 'modelId': model['name'] + ' - ' + version['name'],
73
+ 'modelUrl': f"https://civitai.com/models/{model['id']}?modelVersionId={version['id']}",
74
+ 'author': model['creator']['username'],
75
+ 'authorUrl': f"https://civitai.com/user/{model['creator']['username']}",
76
+ 'mirrorUrl': f"https://civitaiarchive.com/models/{model['id']}?modelVersionId={version['id']}",
77
+ }
78
  return output
79
 
80
  except requests.exceptions.RequestException as e: