-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sctg-development/dev
Dev
- Loading branch information
Showing
7 changed files
with
1,860 additions
and
2,790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
dist | ||
api.key | ||
.DS_Store | ||
config.json |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"os.environ['HF_TOKEN'] = 'hf_…………'\n", | ||
"dataset_name = 'eltorio/ai-prompts'\n", | ||
"prompts_src = 'config.json'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Login to Hugging Face" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Hugging Face token found in environment variable\n" | ||
] | ||
}, | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"Note: Environment variable`HF_TOKEN` is set and is the current active token independently from the token you've just configured.\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"### Login to Hugging Face\n", | ||
"from huggingface_hub import login\n", | ||
"import os\n", | ||
"\n", | ||
"HF_TOKEN = \"\"\n", | ||
"\n", | ||
"if os.environ.get('HF_TOKEN') is not None:\n", | ||
" HF_TOKEN = os.environ.get('HF_TOKEN')\n", | ||
" print(f\"Hugging Face token found in environment variable\")\n", | ||
"try:\n", | ||
" import google.colab\n", | ||
" from google.colab import userdata\n", | ||
" if (userdata.get('HF_TOKEN') is not None) and (HF_TOKEN == \"\"):\n", | ||
" HF_TOKEN = userdata.get('HF_TOKEN')\n", | ||
" else:\n", | ||
" raise ValueError(\"Please set your Hugging Face token in the user data panel, or pass it as an environment variable\")\n", | ||
"except ModuleNotFoundError:\n", | ||
" if HF_TOKEN is None:\n", | ||
" raise ValueError(\"Please set your Hugging Face token in the user data panel, or pass it as an environment variable\")\n", | ||
"\n", | ||
"login(\n", | ||
" token=HF_TOKEN,\n", | ||
" add_to_git_credential=True\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import json\n", | ||
"\n", | ||
"prompts = json.loads(open(prompts_src, 'r').read())\n", | ||
"# remove standalone column\n", | ||
"for prompt in prompts:\n", | ||
" if 'standalone' in prompt:\n", | ||
" del prompt['standalone']\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 16, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"from datasets import Dataset\n", | ||
"pd = pd.DataFrame(prompts)\n", | ||
"dataset = Dataset.from_pandas(pd)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 19, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "5db8b3622de1491e8d35e92616524e96", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"Uploading the dataset shards: 0%| | 0/1 [00:00<?, ?it/s]" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
}, | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "ce0bb9646d6f4a5b94fcbae5febf977f", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"Creating parquet from Arrow format: 0%| | 0/1 [00:00<?, ?ba/s]" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"CommitInfo(commit_url='https://huggingface.co/datasets/eltorio/ai-prompts/commit/bdebad7b860a36dbd4e07f957f36d7da9846ea9a', commit_message='Upload dataset', commit_description='', oid='bdebad7b860a36dbd4e07f957f36d7da9846ea9a', pr_url=None, repo_url=RepoUrl('https://huggingface.co/datasets/eltorio/ai-prompts', endpoint='https://huggingface.co', repo_type='dataset', repo_id='eltorio/ai-prompts'), pr_revision=None, pr_num=None)" | ||
] | ||
}, | ||
"execution_count": 19, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"dataset.push_to_hub(dataset_name)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "base", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.7" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const versionInfo = { | ||
commit: "a859828ce077447711338df714a4ea6a0b0236f2", | ||
date: "2024-11-06 17:40:45 +0100", | ||
commit: "463ef47853239e4b21154323382e091f18f124cd", | ||
date: "2024-11-25 09:51:49 +0100", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { config } from "../src/aipane/config"; | ||
import { writeFileSync } from "fs"; | ||
|
||
export const getPrompts = () => { | ||
return config.prompts; | ||
}; | ||
|
||
writeFileSync("./config.json", JSON.stringify(getPrompts(), null, 2)); |