LysandreJik commited on
Commit
c3e3b63
1 Parent(s): 60cd313

Dataset upload

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -1,4 +1,8 @@
 
 
 
1
  import gradio as gr
 
2
 
3
  default_question = """
4
  We're going to use the <a href="https://huggingface.co/datasets/wikitext"><code>wikitext (link)</a></code> dataset with the <code><a href="https://huggingface.co/bert-base-cased?">bert-base-cased (link)</a></code> model checkpoint.
@@ -59,6 +63,7 @@ with gr.Blocks() as demo:
59
  internship_choice.change(filter_species, internship_choice, [summary, details_col])
60
 
61
  def on_click(_details, _username):
 
62
  return f"Submitted: '{_details}' for user '{_username}'"
63
 
64
  generate_btn.click(on_click, inputs=[details, username], outputs=[output])
 
1
+ import os
2
+ from io import BytesIO
3
+
4
  import gradio as gr
5
+ from huggingface_hub import upload_file
6
 
7
  default_question = """
8
  We're going to use the <a href="https://huggingface.co/datasets/wikitext"><code>wikitext (link)</a></code> dataset with the <code><a href="https://huggingface.co/bert-base-cased?">bert-base-cased (link)</a></code> model checkpoint.
 
63
  internship_choice.change(filter_species, internship_choice, [summary, details_col])
64
 
65
  def on_click(_details, _username):
66
+ upload_file(path_or_fileobj=BytesIO(_details), path_in_repo=_username, repo_id='lysandre/internships', repo_type='dataset', token=os.environ['HF_TOKEN'])
67
  return f"Submitted: '{_details}' for user '{_username}'"
68
 
69
  generate_btn.click(on_click, inputs=[details, username], outputs=[output])