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 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 4,
|
| 6 |
+
"id": "74ee58a0-8c1a-4650-bb45-367214130cde",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [
|
| 9 |
+
{
|
| 10 |
+
"name": "stdout",
|
| 11 |
+
"output_type": "stream",
|
| 12 |
+
"text": [
|
| 13 |
+
"Run this to confirm the notebook is working.\n"
|
| 14 |
+
]
|
| 15 |
+
}
|
| 16 |
+
],
|
| 17 |
+
"source": [
|
| 18 |
+
"print(\"Run this to confirm the notebook is working.\")"
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "code",
|
| 23 |
+
"execution_count": null,
|
| 24 |
+
"id": "0889a582-4903-496f-99e7-7cdcdffe9f29",
|
| 25 |
+
"metadata": {},
|
| 26 |
+
"outputs": [],
|
| 27 |
+
"source": [
|
| 28 |
+
"# Please make sure you are logged in with `huggingface-cli login`"
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"cell_type": "code",
|
| 33 |
+
"execution_count": 2,
|
| 34 |
+
"id": "40b30b76-185c-4404-b5ed-157a7c745ce1",
|
| 35 |
+
"metadata": {
|
| 36 |
+
"collapsed": true,
|
| 37 |
+
"jupyter": {
|
| 38 |
+
"outputs_hidden": true
|
| 39 |
+
},
|
| 40 |
+
"tags": []
|
| 41 |
+
},
|
| 42 |
+
"outputs": [
|
| 43 |
+
{
|
| 44 |
+
"name": "stdout",
|
| 45 |
+
"output_type": "stream",
|
| 46 |
+
"text": [
|
| 47 |
+
"Requirement already satisfied: huggingface_hub in /home/user/miniconda/lib/python3.9/site-packages (0.23.0)\n",
|
| 48 |
+
"Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/user/miniconda/lib/python3.9/site-packages (from huggingface_hub) (4.11.0)\n",
|
| 49 |
+
"Requirement already satisfied: packaging>=20.9 in /home/user/miniconda/lib/python3.9/site-packages (from huggingface_hub) (24.0)\n",
|
| 50 |
+
"Requirement already satisfied: tqdm>=4.42.1 in /home/user/miniconda/lib/python3.9/site-packages (from huggingface_hub) (4.61.2)\n",
|
| 51 |
+
"Requirement already satisfied: pyyaml>=5.1 in /home/user/miniconda/lib/python3.9/site-packages (from huggingface_hub) (6.0.1)\n",
|
| 52 |
+
"Requirement already satisfied: requests in /home/user/miniconda/lib/python3.9/site-packages (from huggingface_hub) (2.31.0)\n",
|
| 53 |
+
"Requirement already satisfied: filelock in /home/user/miniconda/lib/python3.9/site-packages (from huggingface_hub) (3.14.0)\n",
|
| 54 |
+
"Requirement already satisfied: fsspec>=2023.5.0 in /home/user/miniconda/lib/python3.9/site-packages (from huggingface_hub) (2024.5.0)\n",
|
| 55 |
+
"Requirement already satisfied: idna<4,>=2.5 in /home/user/miniconda/lib/python3.9/site-packages (from requests->huggingface_hub) (2.10)\n",
|
| 56 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /home/user/miniconda/lib/python3.9/site-packages (from requests->huggingface_hub) (2021.5.30)\n",
|
| 57 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /home/user/miniconda/lib/python3.9/site-packages (from requests->huggingface_hub) (1.26.6)\n",
|
| 58 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /home/user/miniconda/lib/python3.9/site-packages (from requests->huggingface_hub) (3.3.2)\n"
|
| 59 |
+
]
|
| 60 |
+
}
|
| 61 |
+
],
|
| 62 |
+
"source": [
|
| 63 |
+
"!pip install huggingface_hub"
|
| 64 |
+
]
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"cell_type": "code",
|
| 68 |
+
"execution_count": 3,
|
| 69 |
+
"id": "03ad7b5e-24ae-49e5-8fa7-e6b30260012f",
|
| 70 |
+
"metadata": {},
|
| 71 |
+
"outputs": [],
|
| 72 |
+
"source": [
|
| 73 |
+
"from huggingface_hub import HfApi\n",
|
| 74 |
+
"\n",
|
| 75 |
+
"api = HfApi()\n"
|
| 76 |
+
]
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"cell_type": "code",
|
| 80 |
+
"execution_count": 4,
|
| 81 |
+
"id": "f19b7b94-54d9-4c57-ad16-544b694d6d17",
|
| 82 |
+
"metadata": {
|
| 83 |
+
"tags": []
|
| 84 |
+
},
|
| 85 |
+
"outputs": [],
|
| 86 |
+
"source": [
|
| 87 |
+
"uploaded_file_info = api.upload_file(\n",
|
| 88 |
+
" path_or_fileobj=\"check.ipynb\",\n",
|
| 89 |
+
" path_in_repo=\"check.ipynb\",\n",
|
| 90 |
+
" repo_id=\"FlawedLLM/Jupyter_Amex\",\n",
|
| 91 |
+
" repo_type=\"space\",\n",
|
| 92 |
+
")"
|
| 93 |
+
]
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
"cell_type": "code",
|
| 97 |
+
"execution_count": null,
|
| 98 |
+
"id": "a7f4ee16-819d-4c43-a904-ed94b5d58a2f",
|
| 99 |
+
"metadata": {},
|
| 100 |
+
"outputs": [],
|
| 101 |
+
"source": [
|
| 102 |
+
"def upload_file(file_path, path_in_repo=\"check/\", repo_id=\"FlawedLLM/Jupyter_Amex\", upload_repo_type=\"space\"):\n",
|
| 103 |
+
" uploaded_file_info = api.upload_file(\n",
|
| 104 |
+
" path_or_fileobj=file_path,\n",
|
| 105 |
+
" path_in_repo=path_in_repo+file_path.split(\"/\")[-1],\n",
|
| 106 |
+
" repo_id=repo_id,\n",
|
| 107 |
+
" repo_type=upload_repo_type,\n",
|
| 108 |
+
" )"
|
| 109 |
+
]
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"cell_type": "code",
|
| 113 |
+
"execution_count": null,
|
| 114 |
+
"id": "8e0a4c9c-995f-41a3-9e76-44a1f40bd5b7",
|
| 115 |
+
"metadata": {},
|
| 116 |
+
"outputs": [],
|
| 117 |
+
"source": [
|
| 118 |
+
"upload_file(file_path=\"check.ipynb\")"
|
| 119 |
+
]
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"cell_type": "code",
|
| 123 |
+
"execution_count": null,
|
| 124 |
+
"id": "44ea87f0-c990-4edc-aaef-e5e190cec112",
|
| 125 |
+
"metadata": {},
|
| 126 |
+
"outputs": [],
|
| 127 |
+
"source": []
|
| 128 |
+
}
|
| 129 |
+
],
|
| 130 |
+
"metadata": {
|
| 131 |
+
"kernelspec": {
|
| 132 |
+
"display_name": "Python 3 (ipykernel)",
|
| 133 |
+
"language": "python",
|
| 134 |
+
"name": "python3"
|
| 135 |
+
},
|
| 136 |
+
"language_info": {
|
| 137 |
+
"codemirror_mode": {
|
| 138 |
+
"name": "ipython",
|
| 139 |
+
"version": 3
|
| 140 |
+
},
|
| 141 |
+
"file_extension": ".py",
|
| 142 |
+
"mimetype": "text/x-python",
|
| 143 |
+
"name": "python",
|
| 144 |
+
"nbconvert_exporter": "python",
|
| 145 |
+
"pygments_lexer": "ipython3",
|
| 146 |
+
"version": "3.9.5"
|
| 147 |
+
}
|
| 148 |
+
},
|
| 149 |
+
"nbformat": 4,
|
| 150 |
+
"nbformat_minor": 5
|
| 151 |
+
}
|