broadfield commited on
Commit
16024d0
·
verified ·
1 Parent(s): 5924975

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -55,7 +55,7 @@ def load_data(file):
55
  def save_data(t,m,l,n,w,p):
56
  title = t.replace('https://',"").replace('/',"_").replace('.',"_")
57
  im = mi.run_1(name=title,img_size=[256,256])
58
- im=f"https://broadfield-a.static.hf.space/file={title}.png"
59
  #uid=uuid.uuid4()
60
  with open('template.html','r') as file:
61
  file_cont=file.read()
@@ -73,14 +73,14 @@ def save_data(t,m,l,n,w,p):
73
  repo_type="space",
74
  )
75
  api.upload_file(
76
- path_or_fileobj=f"/images/{title}.png",
77
  path_in_repo=f"/images/{title}.png",
78
  repo_id=f'{user_name}/{repo_name}',
79
  token=token,
80
  repo_type="space",
81
  )
82
  #return f"https://broadfield-a.hf.space/?pdfurl={t}&mod={m}&len={l}&nos={n}&wid={w}&pau={p}"
83
- return f"<div><a href='https://broadfield-a.static.hf.space/{title}_{rand}.html' target='_blank'>https://broadfield-a.static.hf.space/{title}_{rand}.html</a></div>"
84
  def load_html(url):
85
  html=f"""<iframe src="https://docs.google.com/viewer?url={url})&embedded=true" frameborder="0" height="1200px" width="100%"></iframe></div>"""
86
  return html
 
55
  def save_data(t,m,l,n,w,p):
56
  title = t.replace('https://',"").replace('/',"_").replace('.',"_")
57
  im = mi.run_1(name=title,img_size=[256,256])
58
+ im2=f"https://broadfield-a.static.hf.space/file={title}.png"
59
  #uid=uuid.uuid4()
60
  with open('template.html','r') as file:
61
  file_cont=file.read()
 
73
  repo_type="space",
74
  )
75
  api.upload_file(
76
+ path_or_fileobj=im2,
77
  path_in_repo=f"/images/{title}.png",
78
  repo_id=f'{user_name}/{repo_name}',
79
  token=token,
80
  repo_type="space",
81
  )
82
  #return f"https://broadfield-a.hf.space/?pdfurl={t}&mod={m}&len={l}&nos={n}&wid={w}&pau={p}"
83
+ return f"<div><a href='https://f'{user_name}-{repo_name}'.static.hf.space/{title}_{rand}.html' target='_blank'>https://broadfield-a.static.hf.space/{title}_{rand}.html</a></div>"
84
  def load_html(url):
85
  html=f"""<iframe src="https://docs.google.com/viewer?url={url})&embedded=true" frameborder="0" height="1200px" width="100%"></iframe></div>"""
86
  return html