Yacine Jernite commited on
Commit
5f1f323
1 Parent(s): 0a10cf1

upload answers

Browse files
Files changed (1) hide show
  1. posts/conclusion.py +20 -1
posts/conclusion.py CHANGED
@@ -1,4 +1,10 @@
 
 
 
 
 
1
  import streamlit as st
 
2
 
3
  title = "Key Takeaways"
4
  description = "Review of the information from previous pages."
@@ -16,6 +22,8 @@ Here are some of the main ideas we have conveyed in this exploration:
16
  Next, please answer the following questions about the information presented in this demo:
17
  """
18
 
 
 
19
 
20
  def run_article():
21
  st.markdown(__KEY_TAKEAWAYS)
@@ -67,4 +75,15 @@ def run_article():
67
  res["comments_suggestions"] = st.text_area(
68
  "Do you have any comments or suggestions?"
69
  )
70
- st.write(res)
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from datetime import datetime
3
+ from io import BytesIO
4
+ from time import time
5
+
6
  import streamlit as st
7
+ from huggingface_hub import upload_file
8
 
9
  title = "Key Takeaways"
10
  description = "Review of the information from previous pages."
 
22
  Next, please answer the following questions about the information presented in this demo:
23
  """
24
 
25
+ _HF_TOKEN = st.secrets["WRITE_TOKEN"]
26
+
27
 
28
  def run_article():
29
  st.markdown(__KEY_TAKEAWAYS)
 
75
  res["comments_suggestions"] = st.text_area(
76
  "Do you have any comments or suggestions?"
77
  )
78
+ with st.button("Submit my answers"):
79
+ fname = datetime.now().strftime("submitted_%d_%m_%y_%H_%M_%S.json")
80
+ submitted_to = upload_file(
81
+ path_or_fileobj=BytesIO(bytearray(json.dumps(res, indent=2), "utf8")),
82
+ path_in_repo=fname,
83
+ repo_id="hf-task-exploration/acm_exploration_poll_answers",
84
+ repo_type="dataset",
85
+ token=_HF_TOKEN,
86
+ )
87
+ if submitted_to.startswith("https"):
88
+ st.markdown("Submitted the following answers: \n---\n\n")
89
+ st.write(res)