Enable direct Colab and Kaggle launch with automatic inference setup
Browse files- README.md +8 -2
- chadgpt_playground.ipynb +50 -8
- notebook.ipynb +188 -0
- playground/README.md +7 -2
README.md
CHANGED
|
@@ -30,11 +30,16 @@ The model uses a custom PyTorch implementation. Run it with the included `infere
|
|
| 30 |
|
| 31 |
### Temporary public playground with a notebook
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
On Kaggle, enable **Internet** in the notebook settings and optionally select a GPU accelerator. CUDA is used when available; CPU also works. Keep the last cell running and share the public URL it prints. The link lasts only while the notebook runtime is active, with a maximum share-link lifetime of one week. See the [notebook setup guide](https://huggingface.co/sam-eer12/chadGPT/blob/main/playground/README.md) and [Gradio's sharing documentation](https://gradio.app/guides/sharing-your-app).
|
| 36 |
|
| 37 |
-
Colab's free managed runtimes restrict using a web UI as the primary interface and may terminate
|
| 38 |
|
| 39 |
### Persistent playground using a Hugging Face Space
|
| 40 |
|
|
@@ -193,6 +198,7 @@ ChadGPT is an educational and research model for exploring small language models
|
|
| 193 |
- `training_info.json`, `training/`: checkpoint metadata, provenance, and source training scripts.
|
| 194 |
- `chadgpt.ipynb`: the original Kaggle training and local inference notebook.
|
| 195 |
- `chadgpt_playground.ipynb`: a launcher notebook for temporary public Gradio demos.
|
|
|
|
| 196 |
- `playground/`: ready-to-upload Gradio Space files and website setup instructions.
|
| 197 |
- `LICENSE`: MIT license, matching the license selected for this model repository.
|
| 198 |
|
|
|
|
| 30 |
|
| 31 |
### Temporary public playground with a notebook
|
| 32 |
|
| 33 |
+
[](https://huggingface.co/sam-eer12/chadGPT/colab)
|
| 34 |
+
[](https://huggingface.co/sam-eer12/chadGPT/kaggle)
|
| 35 |
+
|
| 36 |
+
Click either button, sign in to that platform, and run **Install dependencies → Download and load → Test inference**. The notebook automatically fetches the Gradio app, inference code, tokenizer, configuration, and approximately 1 GB of model weights from this public repository. No cloning, manual file uploads, Hugging Face PRO subscription, or model-download token is needed.
|
| 37 |
+
|
| 38 |
+
The optional **Launch and share** cell uses the same Gradio app and calls `demo.launch(share=True)` to generate a public `https://…gradio.live` link. You can also [download the notebook](https://huggingface.co/sam-eer12/chadGPT/resolve/main/chadgpt_playground.ipynb?download=true). The root [`notebook.ipynb`](notebook.ipynb) is an identical copy used by [Hugging Face's Colab and Kaggle launch integration](https://huggingface.co/docs/hub/notebooks).
|
| 39 |
|
| 40 |
On Kaggle, enable **Internet** in the notebook settings and optionally select a GPU accelerator. CUDA is used when available; CPU also works. Keep the last cell running and share the public URL it prints. The link lasts only while the notebook runtime is active, with a maximum share-link lifetime of one week. See the [notebook setup guide](https://huggingface.co/sam-eer12/chadGPT/blob/main/playground/README.md) and [Gradio's sharing documentation](https://gradio.app/guides/sharing-your-app).
|
| 41 |
|
| 42 |
+
For Colab, the **Test inference** cell runs directly in the notebook. Colab's free managed runtimes restrict using a web UI as the primary interface and may terminate a shared Gradio demo; use the optional sharing cell only in a runtime whose rules permit it. See the [Colab FAQ](https://research.google.com/colaboratory/faq.html). This route hosts generation in your notebook runtime; the Hugging Face model page provides the weights and launcher files.
|
| 43 |
|
| 44 |
### Persistent playground using a Hugging Face Space
|
| 45 |
|
|
|
|
| 198 |
- `training_info.json`, `training/`: checkpoint metadata, provenance, and source training scripts.
|
| 199 |
- `chadgpt.ipynb`: the original Kaggle training and local inference notebook.
|
| 200 |
- `chadgpt_playground.ipynb`: a launcher notebook for temporary public Gradio demos.
|
| 201 |
+
- `notebook.ipynb`: the same launcher under the filename required for direct Colab and Kaggle opening.
|
| 202 |
- `playground/`: ready-to-upload Gradio Space files and website setup instructions.
|
| 203 |
- `LICENSE`: MIT license, matching the license selected for this model repository.
|
| 204 |
|
chadgpt_playground.ipynb
CHANGED
|
@@ -5,15 +5,21 @@
|
|
| 5 |
"id": "playground-intro",
|
| 6 |
"metadata": {},
|
| 7 |
"source": [
|
| 8 |
-
"# ChadGPT —
|
| 9 |
"\n",
|
| 10 |
-
"
|
|
|
|
| 11 |
"\n",
|
| 12 |
-
"
|
| 13 |
"\n",
|
| 14 |
-
"
|
|
|
|
|
|
|
|
|
|
| 15 |
"\n",
|
| 16 |
-
"The
|
|
|
|
|
|
|
| 17 |
"\n",
|
| 18 |
"[Model card and full training history](https://huggingface.co/sam-eer12/chadGPT) · [Gradio app source](https://huggingface.co/sam-eer12/chadGPT/blob/main/playground/app.py)\n",
|
| 19 |
"\n",
|
|
@@ -81,7 +87,39 @@
|
|
| 81 |
"model, tokenizer, _ = playground_app.get_runtime()\n",
|
| 82 |
"print('Model ready on:', next(model.parameters()).device)\n",
|
| 83 |
"print('PyTorch:', torch.__version__)\n",
|
| 84 |
-
"print('Run the next cell to
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
]
|
| 86 |
},
|
| 87 |
{
|
|
@@ -89,7 +127,7 @@
|
|
| 89 |
"id": "launch-guide",
|
| 90 |
"metadata": {},
|
| 91 |
"source": [
|
| 92 |
-
"##
|
| 93 |
"\n",
|
| 94 |
"Run the cell below. Copy the **Running on public URL: `https://…gradio.live`** link from its output. Anyone with that link can open the chat interface.\n",
|
| 95 |
"\n",
|
|
@@ -113,7 +151,7 @@
|
|
| 113 |
"id": "stop-guide",
|
| 114 |
"metadata": {},
|
| 115 |
"source": [
|
| 116 |
-
"##
|
| 117 |
"\n",
|
| 118 |
"First interrupt the running launch cell using its stop button, then run this optional cleanup cell. You can also stop/disconnect the notebook runtime."
|
| 119 |
]
|
|
@@ -132,6 +170,10 @@
|
|
| 132 |
}
|
| 133 |
],
|
| 134 |
"metadata": {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
"kernelspec": {
|
| 136 |
"display_name": "Python 3",
|
| 137 |
"language": "python",
|
|
|
|
| 5 |
"id": "playground-intro",
|
| 6 |
"metadata": {},
|
| 7 |
"source": [
|
| 8 |
+
"# ChadGPT — open, run, and test\n",
|
| 9 |
"\n",
|
| 10 |
+
"[](https://huggingface.co/sam-eer12/chadGPT/colab)\n",
|
| 11 |
+
"[](https://huggingface.co/sam-eer12/chadGPT/kaggle)\n",
|
| 12 |
"\n",
|
| 13 |
+
"This notebook installs the required packages and automatically fetches the inference code, tokenizer, configuration, Gradio app, and model weights from **sam-eer12/chadGPT** on Hugging Face. No code to clone, files to upload, or Hugging Face login/token is needed.\n",
|
| 14 |
"\n",
|
| 15 |
+
"1. Open either launcher link and sign in to Colab or Kaggle.\n",
|
| 16 |
+
"2. On **Kaggle**, enable **Internet** in notebook settings. Optionally select a GPU accelerator; CPU also works. Complete any account verification that Kaggle requests. On **Colab**, connect a runtime; a GPU is optional.\n",
|
| 17 |
+
"3. Run **Install dependencies → Download and load → Test inference** in order. Read or change the example prompt in the test cell to try the model inside the notebook.\n",
|
| 18 |
+
"4. Optionally run **Launch and share** to create a public **`https://…gradio.live`** chat link. Keep its cell and runtime running while sharing it.\n",
|
| 19 |
"\n",
|
| 20 |
+
"The first model download is approximately **1 GB**. CUDA is selected when available, otherwise Apple MPS or CPU. Installation keeps the notebook's existing PyTorch/CUDA stack. No Hugging Face PRO subscription is required.\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"**Colab:** use the inference test directly in the notebook. [Free managed Colab runtimes restrict using a web UI as the primary interface](https://research.google.com/colaboratory/faq.html) and may terminate shared Gradio demos. Run the optional sharing cell only in a runtime whose rules allow it.\n",
|
| 23 |
"\n",
|
| 24 |
"[Model card and full training history](https://huggingface.co/sam-eer12/chadGPT) · [Gradio app source](https://huggingface.co/sam-eer12/chadGPT/blob/main/playground/app.py)\n",
|
| 25 |
"\n",
|
|
|
|
| 87 |
"model, tokenizer, _ = playground_app.get_runtime()\n",
|
| 88 |
"print('Model ready on:', next(model.parameters()).device)\n",
|
| 89 |
"print('PyTorch:', torch.__version__)\n",
|
| 90 |
+
"print('Run the next cell to test inference; Gradio sharing is optional.')"
|
| 91 |
+
]
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"cell_type": "markdown",
|
| 95 |
+
"id": "inference-guide",
|
| 96 |
+
"metadata": {},
|
| 97 |
+
"source": [
|
| 98 |
+
"## 3. Test inference inside the notebook\n",
|
| 99 |
+
"\n",
|
| 100 |
+
"Run this cell for a sample response. Change **prompt** and run it again to ask another question. This test prints the answer here and does not start a public web server."
|
| 101 |
+
]
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"cell_type": "code",
|
| 105 |
+
"execution_count": null,
|
| 106 |
+
"id": "test-inference",
|
| 107 |
+
"metadata": {},
|
| 108 |
+
"outputs": [],
|
| 109 |
+
"source": [
|
| 110 |
+
"prompt = \"Explain what a neural network is in simple terms.\" #@param {type:\"string\"}\n",
|
| 111 |
+
"max_new_tokens = 96 #@param {type:\"integer\"}\n",
|
| 112 |
+
"\n",
|
| 113 |
+
"model, tokenizer, chat = playground_app.get_runtime()\n",
|
| 114 |
+
"response = chat(\n",
|
| 115 |
+
" model, tokenizer,\n",
|
| 116 |
+
" messages=[\n",
|
| 117 |
+
" {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n",
|
| 118 |
+
" {\"role\": \"user\", \"content\": prompt},\n",
|
| 119 |
+
" ],\n",
|
| 120 |
+
" max_new_tokens=int(max_new_tokens), temperature=0.7, top_k=40,\n",
|
| 121 |
+
")\n",
|
| 122 |
+
"print(response or \"The model ended its response without generating text. Try another prompt.\")"
|
| 123 |
]
|
| 124 |
},
|
| 125 |
{
|
|
|
|
| 127 |
"id": "launch-guide",
|
| 128 |
"metadata": {},
|
| 129 |
"source": [
|
| 130 |
+
"## 4. Optional: launch and share Gradio\n",
|
| 131 |
"\n",
|
| 132 |
"Run the cell below. Copy the **Running on public URL: `https://…gradio.live`** link from its output. Anyone with that link can open the chat interface.\n",
|
| 133 |
"\n",
|
|
|
|
| 151 |
"id": "stop-guide",
|
| 152 |
"metadata": {},
|
| 153 |
"source": [
|
| 154 |
+
"## 5. Stop the demo when finished\n",
|
| 155 |
"\n",
|
| 156 |
"First interrupt the running launch cell using its stop button, then run this optional cleanup cell. You can also stop/disconnect the notebook runtime."
|
| 157 |
]
|
|
|
|
| 170 |
}
|
| 171 |
],
|
| 172 |
"metadata": {
|
| 173 |
+
"colab": {
|
| 174 |
+
"name": "ChadGPT Playground",
|
| 175 |
+
"provenance": []
|
| 176 |
+
},
|
| 177 |
"kernelspec": {
|
| 178 |
"display_name": "Python 3",
|
| 179 |
"language": "python",
|
notebook.ipynb
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "playground-intro",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# ChadGPT — open, run, and test\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"[](https://huggingface.co/sam-eer12/chadGPT/colab)\n",
|
| 11 |
+
"[](https://huggingface.co/sam-eer12/chadGPT/kaggle)\n",
|
| 12 |
+
"\n",
|
| 13 |
+
"This notebook installs the required packages and automatically fetches the inference code, tokenizer, configuration, Gradio app, and model weights from **sam-eer12/chadGPT** on Hugging Face. No code to clone, files to upload, or Hugging Face login/token is needed.\n",
|
| 14 |
+
"\n",
|
| 15 |
+
"1. Open either launcher link and sign in to Colab or Kaggle.\n",
|
| 16 |
+
"2. On **Kaggle**, enable **Internet** in notebook settings. Optionally select a GPU accelerator; CPU also works. Complete any account verification that Kaggle requests. On **Colab**, connect a runtime; a GPU is optional.\n",
|
| 17 |
+
"3. Run **Install dependencies → Download and load → Test inference** in order. Read or change the example prompt in the test cell to try the model inside the notebook.\n",
|
| 18 |
+
"4. Optionally run **Launch and share** to create a public **`https://…gradio.live`** chat link. Keep its cell and runtime running while sharing it.\n",
|
| 19 |
+
"\n",
|
| 20 |
+
"The first model download is approximately **1 GB**. CUDA is selected when available, otherwise Apple MPS or CPU. Installation keeps the notebook's existing PyTorch/CUDA stack. No Hugging Face PRO subscription is required.\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"**Colab:** use the inference test directly in the notebook. [Free managed Colab runtimes restrict using a web UI as the primary interface](https://research.google.com/colaboratory/faq.html) and may terminate shared Gradio demos. Run the optional sharing cell only in a runtime whose rules allow it.\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"[Model card and full training history](https://huggingface.co/sam-eer12/chadGPT) · [Gradio app source](https://huggingface.co/sam-eer12/chadGPT/blob/main/playground/app.py)\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"ChadGPT is an experimental 250M-parameter model trained from scratch on Kaggle over approximately two months. Its answers and generated code can be incorrect."
|
| 27 |
+
]
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"cell_type": "markdown",
|
| 31 |
+
"id": "install-guide",
|
| 32 |
+
"metadata": {},
|
| 33 |
+
"source": [
|
| 34 |
+
"## 1. Install inference dependencies\n",
|
| 35 |
+
"\n",
|
| 36 |
+
"This cell deliberately does not install the Space-only CPU PyTorch wheel. Kaggle and Colab normally provide PyTorch already. On a local notebook without PyTorch, install it separately first."
|
| 37 |
+
]
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"cell_type": "code",
|
| 41 |
+
"execution_count": null,
|
| 42 |
+
"id": "install-packages",
|
| 43 |
+
"metadata": {},
|
| 44 |
+
"outputs": [],
|
| 45 |
+
"source": [
|
| 46 |
+
"%pip install -q gradio==6.29.1 tiktoken==0.12.0 safetensors==0.8.0 huggingface_hub==1.21.0"
|
| 47 |
+
]
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"cell_type": "markdown",
|
| 51 |
+
"id": "load-guide",
|
| 52 |
+
"metadata": {},
|
| 53 |
+
"source": [
|
| 54 |
+
"## 2. Download the existing app and load the model\n",
|
| 55 |
+
"\n",
|
| 56 |
+
"The Gradio interface is reused directly from the public Hugging Face repository. The app pins its weights and inference implementation to the verified initial model release."
|
| 57 |
+
]
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"cell_type": "code",
|
| 61 |
+
"execution_count": null,
|
| 62 |
+
"id": "load-playground",
|
| 63 |
+
"metadata": {},
|
| 64 |
+
"outputs": [],
|
| 65 |
+
"source": [
|
| 66 |
+
"import importlib.util\n",
|
| 67 |
+
"import os\n",
|
| 68 |
+
"import sys\n",
|
| 69 |
+
"\n",
|
| 70 |
+
"import torch\n",
|
| 71 |
+
"from huggingface_hub import hf_hub_download\n",
|
| 72 |
+
"\n",
|
| 73 |
+
"os.environ['CHADGPT_DEVICE'] = 'auto'\n",
|
| 74 |
+
"os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'\n",
|
| 75 |
+
"\n",
|
| 76 |
+
"# Close only this notebook's previous demo if this cell is rerun.\n",
|
| 77 |
+
"if 'playground_app' in globals():\n",
|
| 78 |
+
" playground_app.demo.close()\n",
|
| 79 |
+
"\n",
|
| 80 |
+
"app_path = hf_hub_download('sam-eer12/chadGPT', 'playground/app.py')\n",
|
| 81 |
+
"spec = importlib.util.spec_from_file_location('chadgpt_playground', app_path)\n",
|
| 82 |
+
"playground_app = importlib.util.module_from_spec(spec)\n",
|
| 83 |
+
"sys.modules[spec.name] = playground_app\n",
|
| 84 |
+
"spec.loader.exec_module(playground_app)\n",
|
| 85 |
+
"\n",
|
| 86 |
+
"print('Loading ChadGPT (approximately 1 GB on first download)…')\n",
|
| 87 |
+
"model, tokenizer, _ = playground_app.get_runtime()\n",
|
| 88 |
+
"print('Model ready on:', next(model.parameters()).device)\n",
|
| 89 |
+
"print('PyTorch:', torch.__version__)\n",
|
| 90 |
+
"print('Run the next cell to test inference; Gradio sharing is optional.')"
|
| 91 |
+
]
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"cell_type": "markdown",
|
| 95 |
+
"id": "inference-guide",
|
| 96 |
+
"metadata": {},
|
| 97 |
+
"source": [
|
| 98 |
+
"## 3. Test inference inside the notebook\n",
|
| 99 |
+
"\n",
|
| 100 |
+
"Run this cell for a sample response. Change **prompt** and run it again to ask another question. This test prints the answer here and does not start a public web server."
|
| 101 |
+
]
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"cell_type": "code",
|
| 105 |
+
"execution_count": null,
|
| 106 |
+
"id": "test-inference",
|
| 107 |
+
"metadata": {},
|
| 108 |
+
"outputs": [],
|
| 109 |
+
"source": [
|
| 110 |
+
"prompt = \"Explain what a neural network is in simple terms.\" #@param {type:\"string\"}\n",
|
| 111 |
+
"max_new_tokens = 96 #@param {type:\"integer\"}\n",
|
| 112 |
+
"\n",
|
| 113 |
+
"model, tokenizer, chat = playground_app.get_runtime()\n",
|
| 114 |
+
"response = chat(\n",
|
| 115 |
+
" model, tokenizer,\n",
|
| 116 |
+
" messages=[\n",
|
| 117 |
+
" {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n",
|
| 118 |
+
" {\"role\": \"user\", \"content\": prompt},\n",
|
| 119 |
+
" ],\n",
|
| 120 |
+
" max_new_tokens=int(max_new_tokens), temperature=0.7, top_k=40,\n",
|
| 121 |
+
")\n",
|
| 122 |
+
"print(response or \"The model ended its response without generating text. Try another prompt.\")"
|
| 123 |
+
]
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"cell_type": "markdown",
|
| 127 |
+
"id": "launch-guide",
|
| 128 |
+
"metadata": {},
|
| 129 |
+
"source": [
|
| 130 |
+
"## 4. Optional: launch and share Gradio\n",
|
| 131 |
+
"\n",
|
| 132 |
+
"Run the cell below. Copy the **Running on public URL: `https://…gradio.live`** link from its output. Anyone with that link can open the chat interface.\n",
|
| 133 |
+
"\n",
|
| 134 |
+
"**Keep this cell running and the runtime connected.** The cell remains busy intentionally. The URL stops working when the runtime or demo stops; share links also expire after at most one week. It is a temporary demo link, not permanent Hugging Face hosting.\n",
|
| 135 |
+
"\n",
|
| 136 |
+
"[How Gradio share links work](https://gradio.app/guides/sharing-your-app)"
|
| 137 |
+
]
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"cell_type": "code",
|
| 141 |
+
"execution_count": null,
|
| 142 |
+
"id": "launch-public-demo",
|
| 143 |
+
"metadata": {},
|
| 144 |
+
"outputs": [],
|
| 145 |
+
"source": [
|
| 146 |
+
"playground_app.demo.launch(share=True, debug=True, inline=True, show_error=True)"
|
| 147 |
+
]
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"cell_type": "markdown",
|
| 151 |
+
"id": "stop-guide",
|
| 152 |
+
"metadata": {},
|
| 153 |
+
"source": [
|
| 154 |
+
"## 5. Stop the demo when finished\n",
|
| 155 |
+
"\n",
|
| 156 |
+
"First interrupt the running launch cell using its stop button, then run this optional cleanup cell. You can also stop/disconnect the notebook runtime."
|
| 157 |
+
]
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"cell_type": "code",
|
| 161 |
+
"execution_count": null,
|
| 162 |
+
"id": "stop-public-demo",
|
| 163 |
+
"metadata": {},
|
| 164 |
+
"outputs": [],
|
| 165 |
+
"source": [
|
| 166 |
+
"if 'playground_app' in globals():\n",
|
| 167 |
+
" playground_app.demo.close()\n",
|
| 168 |
+
" print('Public demo stopped.')"
|
| 169 |
+
]
|
| 170 |
+
}
|
| 171 |
+
],
|
| 172 |
+
"metadata": {
|
| 173 |
+
"colab": {
|
| 174 |
+
"name": "ChadGPT Playground",
|
| 175 |
+
"provenance": []
|
| 176 |
+
},
|
| 177 |
+
"kernelspec": {
|
| 178 |
+
"display_name": "Python 3",
|
| 179 |
+
"language": "python",
|
| 180 |
+
"name": "python3"
|
| 181 |
+
},
|
| 182 |
+
"language_info": {
|
| 183 |
+
"name": "python"
|
| 184 |
+
}
|
| 185 |
+
},
|
| 186 |
+
"nbformat": 4,
|
| 187 |
+
"nbformat_minor": 5
|
| 188 |
+
}
|
playground/README.md
CHANGED
|
@@ -27,7 +27,12 @@ The model is educational and experimental: it can produce inaccurate answers, re
|
|
| 27 |
|
| 28 |
## Temporary notebook demo with share=True
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
```python
|
| 33 |
playground_app.demo.launch(share=True, debug=True, inline=True, show_error=True)
|
|
@@ -35,7 +40,7 @@ playground_app.demo.launch(share=True, debug=True, inline=True, show_error=True)
|
|
| 35 |
|
| 36 |
For Kaggle, turn **Internet** on in the notebook settings and optionally select a GPU accelerator. Then run the cells in order. If the account cannot enable internet or a GPU, complete the verification requested by Kaggle on its website. The launcher also works on CPU.
|
| 37 |
|
| 38 |
-
For Colab,
|
| 39 |
|
| 40 |
Copy the **Running on public URL: `https://…gradio.live`** link from the last cell and share it. The notebook must keep running and connected. The link stops working when its runtime stops, and Gradio share links have a maximum lifetime of one week. This is a temporary demo, not permanent HF hosting. No Hugging Face PRO subscription or model-download token is needed. See [Gradio sharing](https://gradio.app/guides/sharing-your-app).
|
| 41 |
|
|
|
|
| 27 |
|
| 28 |
## Temporary notebook demo with share=True
|
| 29 |
|
| 30 |
+
[](https://huggingface.co/sam-eer12/chadGPT/colab)
|
| 31 |
+
[](https://huggingface.co/sam-eer12/chadGPT/kaggle)
|
| 32 |
+
|
| 33 |
+
Open either launcher link and sign in to that platform. Run **Install dependencies → Download and load → Test inference**. The notebook installs the small inference dependencies and automatically fetches this app, the inference code, tokenizer, configuration, and model weights from Hugging Face. There is no repository to clone or file to upload. A [downloadable copy](https://huggingface.co/sam-eer12/chadGPT/resolve/main/chadgpt_playground.ipynb?download=true) is also available.
|
| 34 |
+
|
| 35 |
+
The optional **Launch and share** cell starts the public Gradio demo:
|
| 36 |
|
| 37 |
```python
|
| 38 |
playground_app.demo.launch(share=True, debug=True, inline=True, show_error=True)
|
|
|
|
| 40 |
|
| 41 |
For Kaggle, turn **Internet** on in the notebook settings and optionally select a GPU accelerator. Then run the cells in order. If the account cannot enable internet or a GPU, complete the verification requested by Kaggle on its website. The launcher also works on CPU.
|
| 42 |
|
| 43 |
+
For Colab, select a runtime and run the inference test directly in the notebook. **Free managed Colab runtimes restrict using a web UI as the primary interface** and may terminate a shared Gradio demo. Use the optional sharing cell in a runtime whose rules permit it, such as an eligible paid/local Colab runtime. See [Colab's restrictions](https://research.google.com/colaboratory/faq.html).
|
| 44 |
|
| 45 |
Copy the **Running on public URL: `https://…gradio.live`** link from the last cell and share it. The notebook must keep running and connected. The link stops working when its runtime stops, and Gradio share links have a maximum lifetime of one week. This is a temporary demo, not permanent HF hosting. No Hugging Face PRO subscription or model-download token is needed. See [Gradio sharing](https://gradio.app/guides/sharing-your-app).
|
| 46 |
|