yoinked commited on
Commit
2cddf47
·
verified ·
1 Parent(s): 1f871fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -143,6 +143,11 @@ paperid: {paperid}
143
  f.write(raw)
144
  def makepreview(x):
145
  return x
 
 
 
 
 
146
  with gr.Blocks(css=basecss, theme='NoCrypt/miku') as demo:
147
  gr.Image("./blue-arxiv.png", container=False, label=None, interactive=False, show_fullscreen_button=False, show_share_button=False, show_download_button=False)
148
  with gr.Tab("search"):
@@ -169,6 +174,15 @@ with gr.Blocks(css=basecss, theme='NoCrypt/miku') as demo:
169
  with gr.Row():
170
  status = gr.Textbox(label="status", lines=1, interactive=False)
171
  publishbutton = gr.Button("publish")
 
 
 
 
 
 
 
 
 
172
  markd.change(fn=makepreview, inputs=markd, outputs=preview)
173
  publishbutton.click(fn=publish_paper, inputs=[title, authors, tags, abst, markd], outputs=status)
174
  searchbutton.click(fn=make_paper_cards, inputs=query, outputs=papercards)
 
143
  f.write(raw)
144
  def makepreview(x):
145
  return x
146
+ def upload(prefix, fname, ext, file):
147
+ fname = prefix+fname
148
+ with fs.open(datasetdir+"uploads/"+fname+"."+ext, "wb") as f:
149
+ f.write(file)
150
+ return f"uploaded, use https://huggingface.co/datasets/yoinked/blue-arxiv-papers/resolve/main/uploads/{fname}.{ext} to include in your paper (so like ![image](https://huggingface.co/datasets/yoinked/blue-arxiv-papers/resolve/main/uploads/{fname}.{ext})) for inline img"
151
  with gr.Blocks(css=basecss, theme='NoCrypt/miku') as demo:
152
  gr.Image("./blue-arxiv.png", container=False, label=None, interactive=False, show_fullscreen_button=False, show_share_button=False, show_download_button=False)
153
  with gr.Tab("search"):
 
174
  with gr.Row():
175
  status = gr.Textbox(label="status", lines=1, interactive=False)
176
  publishbutton = gr.Button("publish")
177
+ with gr.Tab("files"):
178
+ with gr.Row():
179
+ prefix = gr.Textbox(label="prefix", lines=1, interactive=True)
180
+ file_name = gr.Textbox(label="file name", lines=1, interactive=True)
181
+ with gr.Row():
182
+ file = gr.File(label="file", file_types=[".png", ".gif", ".webp", ".jpg", ".wav", ".mp3"])
183
+ fileext = gr.Dropdown(["png", "gif", "webp", "jpg", "wav", "mp3"])
184
+ uploadbutton = gr.Button("upload")
185
+ uploadbutton.click(fn=upload, inputs=[prefix, file_name, fileext, file], outputs=preview)
186
  markd.change(fn=makepreview, inputs=markd, outputs=preview)
187
  publishbutton.click(fn=publish_paper, inputs=[title, authors, tags, abst, markd], outputs=status)
188
  searchbutton.click(fn=make_paper_cards, inputs=query, outputs=papercards)