cassiebuhler commited on
Commit
6a1a3b0
1 Parent(s): c67e57e

adding api call

Browse files
Files changed (1) hide show
  1. preprocess.ipynb +27 -0
preprocess.ipynb CHANGED
@@ -74,6 +74,33 @@
74
  "\n",
75
  "df_first.execute().to_parquet(\"us_localities.parquet\")\n"
76
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
  ],
79
  "metadata": {
 
74
  "\n",
75
  "df_first.execute().to_parquet(\"us_localities.parquet\")\n"
76
  ]
77
+ },
78
+ {
79
+ "cell_type": "code",
80
+ "execution_count": null,
81
+ "id": "ca02743f-0bf4-46e5-91fd-a5fe37519ecd",
82
+ "metadata": {},
83
+ "outputs": [],
84
+ "source": [
85
+ "import subprocess\n",
86
+ "import os\n",
87
+ "from huggingface_hub import HfApi, login\n",
88
+ "import streamlit as st\n",
89
+ "\n",
90
+ "login(st.secrets[\"HF_TOKEN\"])\n",
91
+ "# api = HfApi(add_to_git_credential=False)\n",
92
+ "api = HfApi()\n",
93
+ "\n",
94
+ "def hf_upload(file, repo_id):\n",
95
+ " info = api.upload_file(\n",
96
+ " path_or_fileobj=file,\n",
97
+ " path_in_repo=file,\n",
98
+ " repo_id=repo_id,\n",
99
+ " repo_type=\"dataset\",\n",
100
+ " )\n",
101
+ "hf_upload(\"us_localities.parquet\", \"boettiger-lab/landvote\")\n",
102
+ "\n"
103
+ ]
104
  }
105
  ],
106
  "metadata": {