anonderpling commited on
Commit
8695673
1 Parent(s): 4a426b4

try to fix :(

Browse files

I have no friggin clue what's wrong. This is the traceback:

```
Traceback (most recent call last):
File "/home/user/.local/lib/python3.11/site-packages/gradio/routes.py", line 414, in run_predict
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/gradio/blocks.py", line 1326, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/gradio/blocks.py", line 1260, in postprocess_data
prediction_value = block.postprocess(prediction_value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/gradio/components.py", line 5982, in postprocess
unindented_y = inspect.cleandoc(y)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/inspect.py", line 873, in cleandoc
lines = doc.expandtabs().split('\n')
^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'expandtabs'
```

Yup, that's all of it.

Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -31,14 +31,14 @@ def duplicate(source_url, preview_url, model_id, dst_repo, token, repo_type, nsf
31
  filename=os.listdir(dir)[0].rsplit('.',1)[0]
32
  if not model_id=="":
33
  apiurl="https://civitai.com/api/v1/model-versions/"+model_id
34
- subprocess.check_call(["wget",apiurl,"-O",f"{dir}/{filename}.civitai.info"])
35
- apimd=f"\n\n[api response]({apiurl})"
36
  else:
37
  apimd=""
38
  if not preview_url=="":
39
- subprocess.check_call(["wget",preview_url,"-O",f"{dir}/{filename}.preview.png"])
40
- previewhtml=f' Here\'s your preview:<br><img src="{preview_url}">'
41
- previewmd=f'\n\n![preview]({preview_url})'
42
  else:
43
  previewmd=""
44
  previewhtml=""
@@ -55,7 +55,7 @@ def duplicate(source_url, preview_url, model_id, dst_repo, token, repo_type, nsf
55
 
56
  if nsfw==True:
57
  repopath=repopath+"/nsfw"
58
- commitmessage=f"{filename} (nsfw)"
59
  previewhtml=previewhtml+"<br>now isn't that a lovely picture?"
60
  else:
61
  commitmessage=filename
@@ -74,7 +74,7 @@ def duplicate(source_url, preview_url, model_id, dst_repo, token, repo_type, nsf
74
  subprocess.check_call([r"rm","-rf",dir])
75
 
76
  return (
77
- f'Find your commit at the top of <a href=\'https://hf.co/{dst_repo}/commits/main{repopath}\' target="_blank" style="text-decoration:underline">your commits</a>, or your pull request <a href="{ret}">here</a>.{previewhtml}'
78
  )
79
 
80
  except Exception as e:
 
31
  filename=os.listdir(dir)[0].rsplit('.',1)[0]
32
  if not model_id=="":
33
  apiurl="https://civitai.com/api/v1/model-versions/"+model_id
34
+ subprocess.check_call(["wget",apiurl,"-O",dir+"/"+filename+".civitai.info"])
35
+ apimd="\n\n[api response]("+apiurl+")"
36
  else:
37
  apimd=""
38
  if not preview_url=="":
39
+ subprocess.check_call(["wget",preview_url,"-O",dir+"/"+filename+".preview.png"])
40
+ previewhtml=" Here's your preview:<br><img src='"+preview_url+"'>"
41
+ previewmd='\n\n![preview]('+preview_url+'})'
42
  else:
43
  previewmd=""
44
  previewhtml=""
 
55
 
56
  if nsfw==True:
57
  repopath=repopath+"/nsfw"
58
+ commitmessage=filename+" (nsfw)"
59
  previewhtml=previewhtml+"<br>now isn't that a lovely picture?"
60
  else:
61
  commitmessage=filename
 
74
  subprocess.check_call([r"rm","-rf",dir])
75
 
76
  return (
77
+ "Find your commit at the top of <a href='https://hf.co/"+dst_repo+"/commits/main"+repopath+"' target='_blank' style='text-decoration:underline'>your commits</a>, or your pull request <a href='"+ret+"'>here</a>."+previewhtml
78
  )
79
 
80
  except Exception as e: