Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| import json | |
| from validate import validate_submission | |
| from huggingface_hub import whoami, create_repo, Repository | |
| import os | |
| from pathlib import Path | |
| from dotenv import load_dotenv | |
| if Path(".env").is_file(): | |
| load_dotenv(".env") | |
| hf_token = os.getenv("HF_TOKEN") | |
| with st.form(key="form"): | |
| uploaded_file = st.file_uploader("Upload a submission.json file", type=["json"]) | |
| if uploaded_file is not None: | |
| data = str(uploaded_file.read(), "utf-8") | |
| json_data = json.loads(data) | |
| token = st.text_input("API token", type="password") | |
| submit_button = st.form_submit_button("Submit") | |
| validate_submission(json_data) | |
| user_info = whoami(token) | |
| user_name = user_info["name"] | |