Upload 14 files
Browse files- .DS_Store +0 -0
- .gitattributes +4 -36
- Attachments/.gitkeep +0 -0
- Attachments/readme.md +2 -0
- Blockchain.zip +3 -0
- README.md +39 -11
- aboutUs.html +5 -4
- dragAndDrop.html +34 -4
- dragDrop.css +9 -0
- dragdrop.js +103 -5
- instructions.html +63 -40
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
.gitattributes
CHANGED
|
@@ -1,36 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
*
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
-
Images/logo.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
# Auto detect text files and perform LF normalization
|
| 2 |
+
* text=auto
|
| 3 |
+
Blockchain.zip filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
images/logo.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Attachments/.gitkeep
ADDED
|
File without changes
|
Attachments/readme.md
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Purpose
|
| 2 |
+
This directory can be used to retain any materials relevant and necessary for the project history. These materials are retained here so they are available for collaboration and version control.
|
Blockchain.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3e50c6d8618fb91368da26307e049bba6fa559c700aa51f393c41a214ad0757d
|
| 3 |
+
size 120774318
|
README.md
CHANGED
|
@@ -1,11 +1,39 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CSE Capstone Project Template
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
This begins your capstone development effort. You will use GitLab as your primary repository for code and documentation. In these early phases, you may not be delivering 'working software' but you will be delivering just enough documentation to show an understanding of the product in order to communicate a high-level understanding of the product, objectives, scope and quality requirements. The issues and boards can also be used to collaborate on research. For those of you on an R&D project, issues are a great way to track each research question. The comments and team collaboration build a large body of knowledge during your efforts.
|
| 5 |
+
|
| 6 |
+
Regarding this readme.md file, ultimately you will update this page to reflect your project and assist anyone who has access to your repository.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
# Read these articles
|
| 10 |
+
Read the following articles to familiarize yourself with Gitlab and how you will be expected to use it during your project.
|
| 11 |
+
|
| 12 |
+
* [How to use GitLab for Agile Software Development](https://about.gitlab.com/blog/2018/03/05/gitlab-for-agile-software-development/).
|
| 13 |
+
* [How to Write a Beautiful and Meaningful README.md*](https://blog.bitsrc.io/how-to-write-beautiful-and-meaningful-readme-md-for-your-next-project-897045e3f991#:~:text=It's%20a%20set%20of%20useful,github%20below%20the%20project%20directory.) - buidling your ReadMe file
|
| 14 |
+
* [Always start with an issue](https://about.gitlab.com/blog/2016/03/03/start-with-an-issue/) - This article discusses issues and how to use them to collaborate. Several issue and merge templates are provided in the .gitlab/issue_templates and .gitlab/merge_request_templates. These should facilitate collaboration and quality. Feel free to edit them to fit the needs of this project.
|
| 15 |
+
* [Template Samples](https://gitlab.com/gitlab-org/gitlab/-/tree/master/.gitlab/issue_templates)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
# Time Tracking
|
| 19 |
+
|
| 20 |
+
Time tracking is NOT required. It's very simple though. There are other useful actions like /done, /assign, /approve and /wip to name a few.
|
| 21 |
+
|
| 22 |
+
| cmd | purpose |
|
| 23 |
+
| ------ | ------ |
|
| 24 |
+
| /estimate | in the issue description, document the initial work estimate in days, hours, or minutes |
|
| 25 |
+
| /spend | in the comments for the issue, indicate how much time you spend working at that time |
|
| 26 |
+
|
| 27 |
+
Here's the link to [Quick Actions](https://docs.gitlab.com/ee/user/project/quick_actions.html).
|
| 28 |
+
|
| 29 |
+
# Branches
|
| 30 |
+
|
| 31 |
+
This project templates includes 2 branches to start with.
|
| 32 |
+
|
| 33 |
+
| **Name** | **Description** |
|
| 34 |
+
| ------ | ------ |
|
| 35 |
+
| Master | Protected branch. You cannot push directly to master. This branch should be what you push to your test server (ceclnx for example) or other devices for your client to review. |
|
| 36 |
+
| . . . | Thereafter, you should follow the code management strategy defined and agreed upon by the team. I recommend a branch from master for each sprint or interval. From the sprint-branch, I recommend branching by issue. Throughout the sprint, rebase your issue branch regularly especially begore a commit. If an issue is incomplete during the prescribed sprint, commit it to the next spring branch. This approach gives the master branch an additional degree of protection. |
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
aboutUs.html
CHANGED
|
@@ -39,16 +39,17 @@
|
|
| 39 |
</div>
|
| 40 |
</div>
|
| 41 |
</nav>
|
|
|
|
| 42 |
|
| 43 |
<!-- Tall, Narrow Header Section -->
|
| 44 |
-
<header class="
|
| 45 |
<div class="container">
|
| 46 |
<h1 class="display-4 text-primary">About Us</h1>
|
| 47 |
</div>
|
| 48 |
</header>
|
| 49 |
|
| 50 |
<!-- Mission Section -->
|
| 51 |
-
|
| 52 |
<section class="text-center mb-4">
|
| 53 |
<h2 class="text-primary">Our Mission</h2>
|
| 54 |
<p>Our mission is to empower users to build custom surveys with ease and flexibility, deploying them
|
|
@@ -98,12 +99,12 @@
|
|
| 98 |
</section>
|
| 99 |
|
| 100 |
<!-- Meet the Team Section with Gray Background -->
|
| 101 |
-
<section class="
|
| 102 |
<h2 class="text-primary text-center mb-5">Meet the Team</h2>
|
| 103 |
<div class="row">
|
| 104 |
<div class="col-md-3 text-center">
|
| 105 |
<div class="card border-0 bg-light">
|
| 106 |
-
<img src="
|
| 107 |
class="card-img-top rounded-circle mx-auto mt-3" style="width: 150px;" alt="Team Member 1">
|
| 108 |
<div class="card-body">
|
| 109 |
<h5 class="card-title">AJ Anastasia</h5>
|
|
|
|
| 39 |
</div>
|
| 40 |
</div>
|
| 41 |
</nav>
|
| 42 |
+
<div class="container mt-5" style="background-color: #ffffff;">
|
| 43 |
|
| 44 |
<!-- Tall, Narrow Header Section -->
|
| 45 |
+
<header class="text-center py-5" style="background-color: #ffffff;">
|
| 46 |
<div class="container">
|
| 47 |
<h1 class="display-4 text-primary">About Us</h1>
|
| 48 |
</div>
|
| 49 |
</header>
|
| 50 |
|
| 51 |
<!-- Mission Section -->
|
| 52 |
+
|
| 53 |
<section class="text-center mb-4">
|
| 54 |
<h2 class="text-primary">Our Mission</h2>
|
| 55 |
<p>Our mission is to empower users to build custom surveys with ease and flexibility, deploying them
|
|
|
|
| 99 |
</section>
|
| 100 |
|
| 101 |
<!-- Meet the Team Section with Gray Background -->
|
| 102 |
+
<section class="py-5" style="background-color: #ffffff;">
|
| 103 |
<h2 class="text-primary text-center mb-5">Meet the Team</h2>
|
| 104 |
<div class="row">
|
| 105 |
<div class="col-md-3 text-center">
|
| 106 |
<div class="card border-0 bg-light">
|
| 107 |
+
<img src=""
|
| 108 |
class="card-img-top rounded-circle mx-auto mt-3" style="width: 150px;" alt="Team Member 1">
|
| 109 |
<div class="card-body">
|
| 110 |
<h5 class="card-title">AJ Anastasia</h5>
|
dragAndDrop.html
CHANGED
|
@@ -93,8 +93,8 @@
|
|
| 93 |
<div class="modal fade" id="exportModal" tabindex="-1" aria-labelledby="exportModalLabel" aria-hidden="true">
|
| 94 |
<div class="modal-dialog">
|
| 95 |
<div class="modal-content">
|
| 96 |
-
<div class="modal-header">
|
| 97 |
-
<h5 class="modal-title" id="exportModalLabel">Export Survey</h5>
|
| 98 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
| 99 |
</div>
|
| 100 |
<div class="modal-body">
|
|
@@ -112,7 +112,7 @@
|
|
| 112 |
<div class="modal-dialog">
|
| 113 |
<div class="modal-content">
|
| 114 |
<div class="modal-header">
|
| 115 |
-
<h5 class="modal-title" id="githubModalLabel">GitHub Upload Details</h5>
|
| 116 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
| 117 |
</div>
|
| 118 |
<div class="modal-body">
|
|
@@ -138,7 +138,7 @@
|
|
| 138 |
<div class="modal-dialog">
|
| 139 |
<div class="modal-content">
|
| 140 |
<div class="modal-header">
|
| 141 |
-
<h5 class="modal-title" id="hfModalLabel">Hugging Face Upload Details</h5>
|
| 142 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
| 143 |
</div>
|
| 144 |
<div class="modal-body">
|
|
@@ -150,6 +150,14 @@
|
|
| 150 |
<label for="access-token-hf" class="form-label">Access Token (Tokens will not be saved)</label>
|
| 151 |
<input type="text" id="access-token-hf" class="form-control" placeholder="Enter your Hugging Face access token">
|
| 152 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
<div class="alert alert-warning" role="alert">
|
| 154 |
⚠ Warning: Files with the name <b>app.py</b> will be overwritten
|
| 155 |
</div>
|
|
@@ -159,6 +167,28 @@
|
|
| 159 |
</div>
|
| 160 |
</div>
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
|
| 164 |
<!-- Button to open Import modal -->
|
|
|
|
| 93 |
<div class="modal fade" id="exportModal" tabindex="-1" aria-labelledby="exportModalLabel" aria-hidden="true">
|
| 94 |
<div class="modal-dialog">
|
| 95 |
<div class="modal-content">
|
| 96 |
+
<div class="modal-header no-drag">
|
| 97 |
+
<h5 class="modal-title no-drag" id="exportModalLabel">Export Survey</h5>
|
| 98 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
| 99 |
</div>
|
| 100 |
<div class="modal-body">
|
|
|
|
| 112 |
<div class="modal-dialog">
|
| 113 |
<div class="modal-content">
|
| 114 |
<div class="modal-header">
|
| 115 |
+
<h5 class="modal-title no-drag" id="githubModalLabel">GitHub Upload Details</h5>
|
| 116 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
| 117 |
</div>
|
| 118 |
<div class="modal-body">
|
|
|
|
| 138 |
<div class="modal-dialog">
|
| 139 |
<div class="modal-content">
|
| 140 |
<div class="modal-header">
|
| 141 |
+
<h5 class="modal-title no-drag" id="hfModalLabel">Hugging Face Upload Details</h5>
|
| 142 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
| 143 |
</div>
|
| 144 |
<div class="modal-body">
|
|
|
|
| 150 |
<label for="access-token-hf" class="form-label">Access Token (Tokens will not be saved)</label>
|
| 151 |
<input type="text" id="access-token-hf" class="form-control" placeholder="Enter your Hugging Face access token">
|
| 152 |
</div>
|
| 153 |
+
<div class="mb-3">
|
| 154 |
+
<label for="sepolia-url" class="form-label">Sepolia URL (Project ID)</label>
|
| 155 |
+
<input type="text" id="sepolia-url" class="form-control" placeholder="Enter your Sepolia URL">
|
| 156 |
+
</div>
|
| 157 |
+
<div class="mb-3">
|
| 158 |
+
<label for="pk" class="form-label">Private Key</label>
|
| 159 |
+
<input type="text" id="pk" class="form-control" placeholder="Enter your Private Key">
|
| 160 |
+
</div>
|
| 161 |
<div class="alert alert-warning" role="alert">
|
| 162 |
⚠ Warning: Files with the name <b>app.py</b> will be overwritten
|
| 163 |
</div>
|
|
|
|
| 167 |
</div>
|
| 168 |
</div>
|
| 169 |
|
| 170 |
+
<div class="modal fade" id="localModal" tabindex="-1" aria-labelledby="localModalLabel" aria-hidden="true">
|
| 171 |
+
<div class="modal-dialog">
|
| 172 |
+
<div class="modal-content">
|
| 173 |
+
<div class="modal-header">
|
| 174 |
+
<h5 class="modal-title" id="localModalLabel">Local Download Details</h5>
|
| 175 |
+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
| 176 |
+
</div>
|
| 177 |
+
<div class="modal-body">
|
| 178 |
+
<div class="mb-3">
|
| 179 |
+
<label for="sepolia-url" class="form-label">Sepolia URL (Project ID)</label>
|
| 180 |
+
<input type="text" id="sepolia-url" class="form-control" placeholder="Enter your Sepolia URL">
|
| 181 |
+
</div>
|
| 182 |
+
<div class="mb-3">
|
| 183 |
+
<label for="pk" class="form-label">Private Key</label>
|
| 184 |
+
<input type="text" id="pk" class="form-control" placeholder="Enter your Private Key">
|
| 185 |
+
</div>
|
| 186 |
+
<button id="submit-upload-local" class="btn btn-primary w-100">Submit <span id="loading-spinner-local" class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="display: none;"></span></button>
|
| 187 |
+
</div>
|
| 188 |
+
</div>
|
| 189 |
+
</div>
|
| 190 |
+
</div>
|
| 191 |
+
|
| 192 |
|
| 193 |
|
| 194 |
<!-- Button to open Import modal -->
|
dragDrop.css
CHANGED
|
@@ -255,6 +255,15 @@ main {
|
|
| 255 |
cursor: move;
|
| 256 |
}
|
| 257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
/* Apply the move cursor only to the handle */
|
| 259 |
.handle {
|
| 260 |
cursor: move;
|
|
|
|
| 255 |
cursor: move;
|
| 256 |
}
|
| 257 |
|
| 258 |
+
.link-like {
|
| 259 |
+
all: unset; /* Remove all default button styles */
|
| 260 |
+
color: #0d6efd; /* Bootstrap blue */
|
| 261 |
+
text-decoration: underline;
|
| 262 |
+
cursor: pointer;
|
| 263 |
+
font: inherit; /* Match surrounding text */
|
| 264 |
+
vertical-align: baseline; /* Align with text */
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
/* Apply the move cursor only to the handle */
|
| 268 |
.handle {
|
| 269 |
cursor: move;
|
dragdrop.js
CHANGED
|
@@ -388,6 +388,7 @@ document.getElementById('save-survey').addEventListener('click', () => {
|
|
| 388 |
});
|
| 389 |
|
| 390 |
// Event listener for local download
|
|
|
|
| 391 |
document.getElementById('download-btn').addEventListener('click', () => {
|
| 392 |
const surveyPythonCode = buildSurveyPythonCode(); // Get Python survey code
|
| 393 |
downloadSurvey(surveyPythonCode); // Trigger local download
|
|
@@ -674,7 +675,7 @@ function formatFinalPageCode(questions, pageCount) {
|
|
| 674 |
pythonCode += ` if st.session_state["disabled"]:\n`;
|
| 675 |
pythonCode += ' with st.spinner(r"$\\textsf{\\normalsize Storing data on IPFS and Ethereum. This operation might take a few minutes. Please wait to receive your confirmation code!}$"):\n';
|
| 676 |
pythonCode += ` try:\n`;
|
| 677 |
-
pythonCode += ` response = {
|
| 678 |
let questionNumber = 1;
|
| 679 |
questions.forEach((question) => {
|
| 680 |
let questionType = question.querySelector('strong').textContent.replace(' Question', '');
|
|
@@ -687,7 +688,8 @@ function formatFinalPageCode(questions, pageCount) {
|
|
| 687 |
questionNumber++;
|
| 688 |
}
|
| 689 |
});
|
| 690 |
-
pythonCode += ` }
|
|
|
|
| 691 |
|
| 692 |
pythonCode += ` except Exception as e:\n`;
|
| 693 |
pythonCode += ` print(e)\n`;
|
|
@@ -779,7 +781,6 @@ function formatPostCode(questionIndices, questions, pageIndex) {
|
|
| 779 |
pythonCode += ' st.warning("Please answer all the questions on this page.", icon="⚠️")\n\n';
|
| 780 |
|
| 781 |
pythonCode += ' st.progress(st.session_state["current_page"]/total_number_pages, text="Progress")\n\n\n';
|
| 782 |
-
|
| 783 |
}
|
| 784 |
|
| 785 |
return pythonCode;
|
|
@@ -806,8 +807,105 @@ function formatPreCode(questions) {
|
|
| 806 |
// Add necessary imports
|
| 807 |
pythonCode += `import streamlit as st\nimport requests\nimport json\nimport web3\n\n`;
|
| 808 |
|
| 809 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 810 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 811 |
pythonCode += `total_number_pages = ${totalPages+1}\n`;
|
| 812 |
pythonCode += 'placeholder_buttons = None\n\n';
|
| 813 |
pythonCode += formatRadioOptions(questions);
|
|
@@ -921,7 +1019,7 @@ function formatSliderQuestionsPython(questions, question, index) {
|
|
| 921 |
const questionText = question.querySelector('input[type="text"]').value;
|
| 922 |
const minValue = question.querySelector('input[placeholder="Min Value"]').value || 0;
|
| 923 |
const maxValue = question.querySelector('input[placeholder="Max Value"]').value || 10;
|
| 924 |
-
const defaultValue = (parseInt(minValue) + parseInt(maxValue)) / 2;
|
| 925 |
pythonCode += ` if st.session_state["Q${index}"] == None:\n`
|
| 926 |
pythonCode += ` st.session_state["Q${index}"] = ${defaultValue}\n`
|
| 927 |
pythonCode += ` st.slider(label="${questionText}",min_value=${minValue},max_value=${maxValue},
|
|
|
|
| 388 |
});
|
| 389 |
|
| 390 |
// Event listener for local download
|
| 391 |
+
// Prompts the user to enter their sepolia URL and private key
|
| 392 |
document.getElementById('download-btn').addEventListener('click', () => {
|
| 393 |
const surveyPythonCode = buildSurveyPythonCode(); // Get Python survey code
|
| 394 |
downloadSurvey(surveyPythonCode); // Trigger local download
|
|
|
|
| 675 |
pythonCode += ` if st.session_state["disabled"]:\n`;
|
| 676 |
pythonCode += ' with st.spinner(r"$\\textsf{\\normalsize Storing data on IPFS and Ethereum. This operation might take a few minutes. Please wait to receive your confirmation code!}$"):\n';
|
| 677 |
pythonCode += ` try:\n`;
|
| 678 |
+
pythonCode += ` response = {\n`;
|
| 679 |
let questionNumber = 1;
|
| 680 |
questions.forEach((question) => {
|
| 681 |
let questionType = question.querySelector('strong').textContent.replace(' Question', '');
|
|
|
|
| 688 |
questionNumber++;
|
| 689 |
}
|
| 690 |
});
|
| 691 |
+
pythonCode += ` }\n`
|
| 692 |
+
pythonCode += ` submission(response)\n`
|
| 693 |
|
| 694 |
pythonCode += ` except Exception as e:\n`;
|
| 695 |
pythonCode += ` print(e)\n`;
|
|
|
|
| 781 |
pythonCode += ' st.warning("Please answer all the questions on this page.", icon="⚠️")\n\n';
|
| 782 |
|
| 783 |
pythonCode += ' st.progress(st.session_state["current_page"]/total_number_pages, text="Progress")\n\n\n';
|
|
|
|
| 784 |
}
|
| 785 |
|
| 786 |
return pythonCode;
|
|
|
|
| 807 |
// Add necessary imports
|
| 808 |
pythonCode += `import streamlit as st\nimport requests\nimport json\nimport web3\n\n`;
|
| 809 |
|
| 810 |
+
pythonCode += 'abi = [{"anonymous":False,"inputs":[{"indexed":False,"internalType":"string","name":"ipfsHash","type":"string"}],"name":"Store","type":"event"},{"inputs":[],"name":"getHashes","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"ipfsHash","type":"string"}],"name":"storeHash","outputs":[],"stateMutability":"nonpayable","type":"function"}]\n'
|
| 811 |
+
pythonCode += `# function that uploads the results to ipfs
|
| 812 |
+
def upload_json_to_ipfs(data):
|
| 813 |
+
try:
|
| 814 |
+
url = "https://api.pinata.cloud/pinning/pinJSONToIPFS"
|
| 815 |
+
|
| 816 |
+
print("starting upload to ipfs")
|
| 817 |
+
|
| 818 |
+
# check for JWT secret
|
| 819 |
+
if "PinataJWT" not in st.secrets:
|
| 820 |
+
st.write("No JWT secret found, please add your JWT in a secret titled \\"PinataJWT\\"")
|
| 821 |
+
return
|
| 822 |
+
|
| 823 |
+
jwt_token = st.secrets["PinataJWT"].strip()
|
| 824 |
+
headers = {
|
| 825 |
+
"Authorization": f"Bearer {jwt_token}",
|
| 826 |
+
"Content-Type": "application/json"
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
# Convert Python dictionary to JSON string
|
| 830 |
+
response = requests.post(url, headers=headers, json=data)
|
| 831 |
+
|
| 832 |
+
if response.status_code == 200:
|
| 833 |
+
# Print the IPFS hash from the successful response
|
| 834 |
+
ipfs_hash = response.json().get("IpfsHash")
|
| 835 |
+
return ipfs_hash
|
| 836 |
+
else:
|
| 837 |
+
st.write(f"Failed to upload JSON. Status code: {response.status_code}")
|
| 838 |
+
st.write(response.text)
|
| 839 |
+
return None
|
| 840 |
+
except Exception as e:
|
| 841 |
+
st.write(f"Error uploading to Pinata: {e}")
|
| 842 |
+
|
| 843 |
+
# function that uploads to blockchain
|
| 844 |
+
def upload_to_blockchain(hash):
|
| 845 |
+
print("starting blockchain upload")
|
| 846 |
+
w3 = web3.Web3(web3.HTTPProvider(st.secrets["infura"]))
|
| 847 |
+
|
| 848 |
+
# create an instance of our contract
|
| 849 |
+
contract = w3.eth.contract(address=st.secrets["ContractAddress"], abi = abi)
|
| 850 |
|
| 851 |
+
# Call your function: 11155111 is Sepolia's id
|
| 852 |
+
call_function = contract.functions.storeHash(hash).build_transaction({"chainId": 11155111,
|
| 853 |
+
"from": st.secrets["EthWallet"],
|
| 854 |
+
"nonce": w3.eth.get_transaction_count(st.secrets["EthWallet"])})
|
| 855 |
+
|
| 856 |
+
# Sign transaction
|
| 857 |
+
signed_tx = w3.eth.account.sign_transaction(call_function, private_key=st.secrets["pk"])
|
| 858 |
+
|
| 859 |
+
# Send transaction
|
| 860 |
+
send_tx = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
|
| 861 |
+
|
| 862 |
+
# Wait for transaction receipt
|
| 863 |
+
tx_receipt = w3.eth.wait_for_transaction_receipt(send_tx)
|
| 864 |
+
|
| 865 |
+
print("ETH Hash:")
|
| 866 |
+
print(tx_receipt.logs[0].transactionHash.hex())
|
| 867 |
+
|
| 868 |
+
return tx_receipt.logs[0].transactionHash.hex()
|
| 869 |
+
|
| 870 |
+
def get_ipfs_hashes():
|
| 871 |
+
w3 = web3.Web3(web3.HTTPProvider(st.secrets["infura"]))
|
| 872 |
+
|
| 873 |
+
# Create an instance of the contract
|
| 874 |
+
contract = w3.eth.contract(address=st.secrets["ContractAddress"], abi=abi)
|
| 875 |
+
|
| 876 |
+
# Call the getHashes function
|
| 877 |
+
try:
|
| 878 |
+
ipfs_hashes = contract.functions.getHashes().call()
|
| 879 |
+
return ipfs_hashes
|
| 880 |
+
except Exception as e:
|
| 881 |
+
st.write(f"Error retrieving hashes: {e}")
|
| 882 |
+
return []
|
| 883 |
+
|
| 884 |
+
def retreive_ipfs_hash_data(hashes):
|
| 885 |
+
results = []
|
| 886 |
+
for ipfs_hash in hashes:
|
| 887 |
+
url = f"https://gateway.pinata.cloud/ipfs/{ipfs_hash}"
|
| 888 |
+
try:
|
| 889 |
+
response = requests.get(url)
|
| 890 |
+
if response.status_code == 200:
|
| 891 |
+
data = response.json()
|
| 892 |
+
results.append({"hash": ipfs_hash, "data": data})
|
| 893 |
+
else:
|
| 894 |
+
results.append({"hash": ipfs_hash, "error": f"Failed to retrieve data (status {response.status_code})"})
|
| 895 |
+
except Exception as e:
|
| 896 |
+
results.append({"hash": ipfs_hash, "error": str(e)})
|
| 897 |
+
return results
|
| 898 |
+
|
| 899 |
+
|
| 900 |
+
# function that handles survey submission
|
| 901 |
+
# sets up ipfs and blockchain
|
| 902 |
+
def submission(survey_data):
|
| 903 |
+
ipfs_hash = upload_json_to_ipfs(survey_data)
|
| 904 |
+
if ipfs_hash:
|
| 905 |
+
print("IPFS Upload Successful")
|
| 906 |
+
print(ipfs_hash)
|
| 907 |
+
upload_to_blockchain(ipfs_hash)\n`
|
| 908 |
+
|
| 909 |
pythonCode += `total_number_pages = ${totalPages+1}\n`;
|
| 910 |
pythonCode += 'placeholder_buttons = None\n\n';
|
| 911 |
pythonCode += formatRadioOptions(questions);
|
|
|
|
| 1019 |
const questionText = question.querySelector('input[type="text"]').value;
|
| 1020 |
const minValue = question.querySelector('input[placeholder="Min Value"]').value || 0;
|
| 1021 |
const maxValue = question.querySelector('input[placeholder="Max Value"]').value || 10;
|
| 1022 |
+
const defaultValue = Math.ceil((parseInt(minValue) + parseInt(maxValue)) / 2);
|
| 1023 |
pythonCode += ` if st.session_state["Q${index}"] == None:\n`
|
| 1024 |
pythonCode += ` st.session_state["Q${index}"] = ${defaultValue}\n`
|
| 1025 |
pythonCode += ` st.slider(label="${questionText}",min_value=${minValue},max_value=${maxValue},
|
instructions.html
CHANGED
|
@@ -68,29 +68,27 @@
|
|
| 68 |
</div>
|
| 69 |
</div>
|
| 70 |
|
| 71 |
-
<!--
|
| 72 |
<div class="card shadow-sm mb-4">
|
| 73 |
<div class="card-header bg-primary text-white">
|
| 74 |
<h3 class="mb-0">
|
| 75 |
<button class="btn btn-link text-white text-decoration-none w-100 d-flex justify-content-between align-items-center collapsed"
|
| 76 |
-
data-bs-toggle="collapse" data-bs-target="#
|
| 77 |
-
|
| 78 |
<i class="bi bi-chevron-down rotate-icon"></i>
|
| 79 |
</button>
|
| 80 |
</h3>
|
| 81 |
</div>
|
| 82 |
-
<div id="
|
| 83 |
<div class="card-body">
|
| 84 |
-
<p class="lead">Instructions on
|
| 85 |
-
<p class="text-muted">This Access Token is used to directly upload the survey to your GitHub repository.</p>
|
| 86 |
<ol class="list-group list-group-numbered">
|
| 87 |
-
<li class="list-group-item">
|
| 88 |
-
<li class="list-group-item">
|
| 89 |
-
<li class="list-group-item">
|
| 90 |
-
<li class="list-group-item">
|
| 91 |
-
<li class="list-group-item">
|
| 92 |
-
<li class="list-group-item">
|
| 93 |
-
<li class="list-group-item"><b>Important:</b> Save the token—you won’t be able to view it again.</li>
|
| 94 |
</ol>
|
| 95 |
</div>
|
| 96 |
</div>
|
|
@@ -122,50 +120,53 @@
|
|
| 122 |
</div>
|
| 123 |
</div>
|
| 124 |
|
| 125 |
-
<!--
|
| 126 |
<div class="card shadow-sm mb-4">
|
| 127 |
<div class="card-header bg-primary text-white">
|
| 128 |
<h3 class="mb-0">
|
| 129 |
<button class="btn btn-link text-white text-decoration-none w-100 d-flex justify-content-between align-items-center collapsed"
|
| 130 |
-
data-bs-toggle="collapse" data-bs-target="#
|
| 131 |
-
|
| 132 |
<i class="bi bi-chevron-down rotate-icon"></i>
|
| 133 |
</button>
|
| 134 |
</h3>
|
| 135 |
</div>
|
| 136 |
-
<div id="
|
| 137 |
<div class="card-body">
|
| 138 |
-
<p class="lead">Instructions on how to
|
|
|
|
| 139 |
<ol class="list-group list-group-numbered">
|
| 140 |
-
<li class="list-group-item">
|
| 141 |
-
<li class="list-group-item">
|
| 142 |
-
<li class="list-group-item">
|
| 143 |
-
<li class="list-group-item">
|
|
|
|
|
|
|
|
|
|
| 144 |
</ol>
|
| 145 |
</div>
|
| 146 |
</div>
|
| 147 |
</div>
|
| 148 |
|
| 149 |
-
<!--
|
| 150 |
<div class="card shadow-sm mb-4">
|
| 151 |
<div class="card-header bg-primary text-white">
|
| 152 |
<h3 class="mb-0">
|
| 153 |
<button class="btn btn-link text-white text-decoration-none w-100 d-flex justify-content-between align-items-center collapsed"
|
| 154 |
-
data-bs-toggle="collapse" data-bs-target="#
|
| 155 |
-
|
| 156 |
<i class="bi bi-chevron-down rotate-icon"></i>
|
| 157 |
</button>
|
| 158 |
</h3>
|
| 159 |
</div>
|
| 160 |
-
<div id="
|
| 161 |
<div class="card-body">
|
| 162 |
-
<p class="lead">Instructions
|
| 163 |
<ol class="list-group list-group-numbered">
|
| 164 |
-
<li class="list-group-item">
|
| 165 |
-
|
| 166 |
-
</li>
|
| 167 |
-
<li class="list-group-item">
|
| 168 |
-
<li class="list-group-item">Step 3: [To be added]</li>
|
| 169 |
</ol>
|
| 170 |
</div>
|
| 171 |
</div>
|
|
@@ -241,17 +242,39 @@
|
|
| 241 |
</div>
|
| 242 |
</div>
|
| 243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
</div>
|
| 245 |
|
| 246 |
<script>
|
| 247 |
-
document.getElementById('download-
|
| 248 |
-
const
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
document.body.removeChild(a2);
|
| 255 |
});
|
| 256 |
</script>
|
| 257 |
|
|
|
|
| 68 |
</div>
|
| 69 |
</div>
|
| 70 |
|
| 71 |
+
<!-- Uploading code instructions -->
|
| 72 |
<div class="card shadow-sm mb-4">
|
| 73 |
<div class="card-header bg-primary text-white">
|
| 74 |
<h3 class="mb-0">
|
| 75 |
<button class="btn btn-link text-white text-decoration-none w-100 d-flex justify-content-between align-items-center collapsed"
|
| 76 |
+
data-bs-toggle="collapse" data-bs-target="#uploadIntruc" aria-expanded="false">
|
| 77 |
+
Uploading survey file directly to Github or Huggingface
|
| 78 |
<i class="bi bi-chevron-down rotate-icon"></i>
|
| 79 |
</button>
|
| 80 |
</h3>
|
| 81 |
</div>
|
| 82 |
+
<div id="uploadIntruc" class="collapse">
|
| 83 |
<div class="card-body">
|
| 84 |
+
<p class="lead">Instructions on upload your survey file directly to Github or Huggingface from our web app.</p>
|
|
|
|
| 85 |
<ol class="list-group list-group-numbered">
|
| 86 |
+
<li class="list-group-item">Generate a <b>Access Token</b> on either your <b>Github</b> or <b>Huggingface</b> account. (Intructions can be found below on how to do that)</li>
|
| 87 |
+
<li class="list-group-item">Create a <b>repository</b> on Github or a <b>space</b> on Huggingface to upload the survey file to.</li>
|
| 88 |
+
<li class="list-group-item">Once you have completed both of these tasks, go to the <b>Survey Builder</b> page on our app.</li>
|
| 89 |
+
<li class="list-group-item">Click <b>Export Survey</b>, then <b>upload to Huggingface</b> or <b>Github</b>.</li>
|
| 90 |
+
<li class="list-group-item">Enter your <b>repository</b> or <b>space</b> name in the format username/repository-name and <b>Access Token</b> you generated at the beginning.</li>
|
| 91 |
+
<li class="list-group-item">Click <b>Submit</b>! This should give you a message on whether it successfully or unsuccessfully uploaded your survey file.</li>
|
|
|
|
| 92 |
</ol>
|
| 93 |
</div>
|
| 94 |
</div>
|
|
|
|
| 120 |
</div>
|
| 121 |
</div>
|
| 122 |
|
| 123 |
+
<!-- GitHub Token Setup -->
|
| 124 |
<div class="card shadow-sm mb-4">
|
| 125 |
<div class="card-header bg-primary text-white">
|
| 126 |
<h3 class="mb-0">
|
| 127 |
<button class="btn btn-link text-white text-decoration-none w-100 d-flex justify-content-between align-items-center collapsed"
|
| 128 |
+
data-bs-toggle="collapse" data-bs-target="#githubSetup" aria-expanded="false">
|
| 129 |
+
GitHub Token Setup
|
| 130 |
<i class="bi bi-chevron-down rotate-icon"></i>
|
| 131 |
</button>
|
| 132 |
</h3>
|
| 133 |
</div>
|
| 134 |
+
<div id="githubSetup" class="collapse">
|
| 135 |
<div class="card-body">
|
| 136 |
+
<p class="lead">Instructions on how to generate an Access Token for GitHub.</p>
|
| 137 |
+
<p class="text-muted">This Access Token is used to directly upload the survey to your GitHub repository.</p>
|
| 138 |
<ol class="list-group list-group-numbered">
|
| 139 |
+
<li class="list-group-item">Go to <a href="https://github.com/" target="_blank">github.com</a> and sign in or create an account.</li>
|
| 140 |
+
<li class="list-group-item">Click your profile picture > <b>Settings</b>.</li>
|
| 141 |
+
<li class="list-group-item">Scroll down > <b>Developer settings</b>.</li>
|
| 142 |
+
<li class="list-group-item">Expand <b>Personal access tokens</b> > <b>Tokens (classic)</b>.</li>
|
| 143 |
+
<li class="list-group-item">Click <b>Generate new token (classic)</b>.</li>
|
| 144 |
+
<li class="list-group-item">Enter a name, select <b>repo</b>, and click <b>Generate token</b>.</li>
|
| 145 |
+
<li class="list-group-item"><b>Important:</b> Save the token—you won’t be able to view it again.</li>
|
| 146 |
</ol>
|
| 147 |
</div>
|
| 148 |
</div>
|
| 149 |
</div>
|
| 150 |
|
| 151 |
+
<!-- Hosting Survey using Streamlit -->
|
| 152 |
<div class="card shadow-sm mb-4">
|
| 153 |
<div class="card-header bg-primary text-white">
|
| 154 |
<h3 class="mb-0">
|
| 155 |
<button class="btn btn-link text-white text-decoration-none w-100 d-flex justify-content-between align-items-center collapsed"
|
| 156 |
+
data-bs-toggle="collapse" data-bs-target="#streamlitHosting" aria-expanded="false">
|
| 157 |
+
Hosting Survey using a Github repository through Streamlit
|
| 158 |
<i class="bi bi-chevron-down rotate-icon"></i>
|
| 159 |
</button>
|
| 160 |
</h3>
|
| 161 |
</div>
|
| 162 |
+
<div id="streamlitHosting" class="collapse">
|
| 163 |
<div class="card-body">
|
| 164 |
+
<p class="lead">Instructions on how to host your survey using a Github repo through Streamlit.</p>
|
| 165 |
<ol class="list-group list-group-numbered">
|
| 166 |
+
<li class="list-group-item">Once you have uploaded the survey file to GitHub, then go to <a href="https://share.streamlit.io/" target="_blank">Streamlit Sharing</a>.</li>
|
| 167 |
+
<li class="list-group-item">Sign in with GitHub and click <b>Create app</b>.</li>
|
| 168 |
+
<li class="list-group-item">Set <b>survey_script.py</b> as the main file path.</li>
|
| 169 |
+
<li class="list-group-item">Click <b>Deploy</b> to launch the app! (This should give you a link to where people can now take your survey)</li>
|
|
|
|
| 170 |
</ol>
|
| 171 |
</div>
|
| 172 |
</div>
|
|
|
|
| 242 |
</div>
|
| 243 |
</div>
|
| 244 |
|
| 245 |
+
<!-- Deploying Smart Contract Setup -->
|
| 246 |
+
<div class="card shadow-sm mb-4">
|
| 247 |
+
<div class="card-header bg-primary text-white">
|
| 248 |
+
<h3 class="mb-0">
|
| 249 |
+
<button class="btn btn-link text-white text-decoration-none w-100 d-flex justify-content-between align-items-center collapsed"
|
| 250 |
+
data-bs-toggle="collapse" data-bs-target="#smartContract" aria-expanded="false">
|
| 251 |
+
Deploying Smart Contract
|
| 252 |
+
<i class="bi bi-chevron-down rotate-icon"></i>
|
| 253 |
+
</button>
|
| 254 |
+
</h3>
|
| 255 |
+
</div>
|
| 256 |
+
<div id="smartContract" class="collapse">
|
| 257 |
+
<div class="card-body">
|
| 258 |
+
<p class="lead">These are instructions on how to deploy a smart contract.</p>
|
| 259 |
+
<ol class="list-group list-group-numbered">
|
| 260 |
+
<li class="list-group-item">Download the <button id="download-smartcontract-btn" class="link-like">Smart Contract deployment</button> zip file</li>
|
| 261 |
+
<li class="list-group-item">Unzip the file and open in a text editor</li>
|
| 262 |
+
</ol>
|
| 263 |
+
</div>
|
| 264 |
+
</div>
|
| 265 |
+
</div>
|
| 266 |
+
|
| 267 |
+
|
| 268 |
</div>
|
| 269 |
|
| 270 |
<script>
|
| 271 |
+
document.getElementById('download-smartcontract-btn').addEventListener('click', () => {
|
| 272 |
+
const a = document.createElement("a");
|
| 273 |
+
a.href = "Blockchain.zip"; // Path to your local ZIP file
|
| 274 |
+
a.download = "Blockchain.zip";
|
| 275 |
+
document.body.appendChild(a);
|
| 276 |
+
a.click();
|
| 277 |
+
document.body.removeChild(a);
|
|
|
|
| 278 |
});
|
| 279 |
</script>
|
| 280 |
|