Suphatit commited on
Commit
da4ef79
Β·
1 Parent(s): a510b5d

Delete GPT (1).ipynb

Browse files
Files changed (1) hide show
  1. GPT (1).ipynb +0 -286
GPT (1).ipynb DELETED
@@ -1,286 +0,0 @@
1
- {
2
- "nbformat": 4,
3
- "nbformat_minor": 0,
4
- "metadata": {
5
- "colab": {
6
- "provenance": []
7
- },
8
- "kernelspec": {
9
- "name": "python3",
10
- "display_name": "Python 3"
11
- },
12
- "language_info": {
13
- "name": "python"
14
- }
15
- },
16
- "cells": [
17
- {
18
- "cell_type": "code",
19
- "execution_count": 2,
20
- "metadata": {
21
- "colab": {
22
- "base_uri": "https://localhost:8080/"
23
- },
24
- "id": "bYEmfDoIAyp1",
25
- "outputId": "37c98819-f0f0-4300-fe87-e8d910bf46bf"
26
- },
27
- "outputs": [
28
- {
29
- "output_type": "stream",
30
- "name": "stdout",
31
- "text": [
32
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m20.1/20.1 MB\u001b[0m \u001b[31m39.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
33
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m66.2/66.2 kB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
34
- "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
35
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m298.2/298.2 kB\u001b[0m \u001b[31m17.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
36
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.4/75.4 kB\u001b[0m \u001b[31m7.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
37
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m268.8/268.8 kB\u001b[0m \u001b[31m20.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
38
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m139.9/139.9 kB\u001b[0m \u001b[31m13.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
39
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.7/45.7 kB\u001b[0m \u001b[31m4.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
40
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m59.5/59.5 kB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
41
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m129.9/129.9 kB\u001b[0m \u001b[31m12.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
42
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m5.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
43
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.0/67.0 kB\u001b[0m \u001b[31m6.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
44
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m74.5/74.5 kB\u001b[0m \u001b[31m7.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
45
- "\u001b[?25h Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n"
46
- ]
47
- }
48
- ],
49
- "source": [
50
- "!pip install -q gradio"
51
- ]
52
- },
53
- {
54
- "cell_type": "code",
55
- "source": [
56
- "!pip install langchain[llms]"
57
- ],
58
- "metadata": {
59
- "colab": {
60
- "base_uri": "https://localhost:8080/"
61
- },
62
- "id": "iHrHZTIUBswq",
63
- "outputId": "6d8e0f46-c591-4ef9-bccc-ea367e4e5470"
64
- },
65
- "execution_count": 3,
66
- "outputs": [
67
- {
68
- "output_type": "stream",
69
- "name": "stdout",
70
- "text": [
71
- "Collecting langchain[llms]\n",
72
- " Downloading langchain-0.0.281-py3-none-any.whl (1.6 MB)\n",
73
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.6/1.6 MB\u001b[0m \u001b[31m7.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
74
- "\u001b[?25hRequirement already satisfied: PyYAML>=5.3 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (6.0.1)\n",
75
- "Requirement already satisfied: SQLAlchemy<3,>=1.4 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (2.0.20)\n",
76
- "Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (3.8.5)\n",
77
- "Requirement already satisfied: async-timeout<5.0.0,>=4.0.0 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (4.0.3)\n",
78
- "Collecting dataclasses-json<0.6.0,>=0.5.7 (from langchain[llms])\n",
79
- " Downloading dataclasses_json-0.5.14-py3-none-any.whl (26 kB)\n",
80
- "Collecting langsmith<0.1.0,>=0.0.21 (from langchain[llms])\n",
81
- " Downloading langsmith-0.0.33-py3-none-any.whl (36 kB)\n",
82
- "Requirement already satisfied: numexpr<3.0.0,>=2.8.4 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (2.8.5)\n",
83
- "Requirement already satisfied: numpy<2,>=1 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (1.23.5)\n",
84
- "Requirement already satisfied: pydantic<3,>=1 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (2.2.1)\n",
85
- "Requirement already satisfied: requests<3,>=2 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (2.31.0)\n",
86
- "Requirement already satisfied: tenacity<9.0.0,>=8.1.0 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (8.2.3)\n",
87
- "Collecting clarifai>=9.1.0 (from langchain[llms])\n",
88
- " Downloading clarifai-9.7.6-py3-none-any.whl (2.4 MB)\n",
89
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.4/2.4 MB\u001b[0m \u001b[31m14.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
90
- "\u001b[?25hCollecting cohere<5,>=4 (from langchain[llms])\n",
91
- " Downloading cohere-4.22-py3-none-any.whl (47 kB)\n",
92
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m47.0/47.0 kB\u001b[0m \u001b[31m4.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
93
- "\u001b[?25hRequirement already satisfied: huggingface_hub<1,>=0 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (0.16.4)\n",
94
- "Collecting manifest-ml<0.0.2,>=0.0.1 (from langchain[llms])\n",
95
- " Downloading manifest_ml-0.0.1-py2.py3-none-any.whl (42 kB)\n",
96
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m42.9/42.9 kB\u001b[0m \u001b[31m4.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
97
- "\u001b[?25hCollecting nlpcloud<2,>=1 (from langchain[llms])\n",
98
- " Downloading nlpcloud-1.1.44-py3-none-any.whl (4.4 kB)\n",
99
- "Collecting openai<1,>=0 (from langchain[llms])\n",
100
- " Downloading openai-0.28.0-py3-none-any.whl (76 kB)\n",
101
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m76.5/76.5 kB\u001b[0m \u001b[31m7.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
102
- "\u001b[?25hCollecting openlm<0.0.6,>=0.0.5 (from langchain[llms])\n",
103
- " Downloading openlm-0.0.5-py3-none-any.whl (10 kB)\n",
104
- "Requirement already satisfied: torch<3,>=1 in /usr/local/lib/python3.10/dist-packages (from langchain[llms]) (2.0.1+cu118)\n",
105
- "Collecting transformers<5,>=4 (from langchain[llms])\n",
106
- " Downloading transformers-4.33.0-py3-none-any.whl (7.6 MB)\n",
107
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.6/7.6 MB\u001b[0m \u001b[31m26.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
108
- "\u001b[?25hRequirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain[llms]) (23.1.0)\n",
109
- "Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain[llms]) (3.2.0)\n",
110
- "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain[llms]) (6.0.4)\n",
111
- "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain[llms]) (1.9.2)\n",
112
- "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain[llms]) (1.4.0)\n",
113
- "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp<4.0.0,>=3.8.3->langchain[llms]) (1.3.1)\n",
114
- "Collecting clarifai-grpc>=9.7.4 (from clarifai>=9.1.0->langchain[llms])\n",
115
- " Downloading clarifai_grpc-9.8.0-py3-none-any.whl (216 kB)\n",
116
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m216.4/216.4 kB\u001b[0m \u001b[31m18.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
117
- "\u001b[?25hCollecting tritonclient==2.34.0 (from clarifai>=9.1.0->langchain[llms])\n",
118
- " Downloading tritonclient-2.34.0-py3-none-manylinux1_x86_64.whl (12.3 MB)\n",
119
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m12.3/12.3 MB\u001b[0m \u001b[31m49.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
120
- "\u001b[?25hRequirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from clarifai>=9.1.0->langchain[llms]) (23.1)\n",
121
- "Collecting tqdm==4.64.1 (from clarifai>=9.1.0->langchain[llms])\n",
122
- " Downloading tqdm-4.64.1-py2.py3-none-any.whl (78 kB)\n",
123
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m78.5/78.5 kB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
124
- "\u001b[?25hCollecting rich==13.4.2 (from clarifai>=9.1.0->langchain[llms])\n",
125
- " Downloading rich-13.4.2-py3-none-any.whl (239 kB)\n",
126
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m239.4/239.4 kB\u001b[0m \u001b[31m20.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
127
- "\u001b[?25hRequirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.10/dist-packages (from rich==13.4.2->clarifai>=9.1.0->langchain[llms]) (3.0.0)\n",
128
- "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.10/dist-packages (from rich==13.4.2->clarifai>=9.1.0->langchain[llms]) (2.16.1)\n",
129
- "Collecting python-rapidjson>=0.9.1 (from tritonclient==2.34.0->clarifai>=9.1.0->langchain[llms])\n",
130
- " Downloading python_rapidjson-1.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB)\n",
131
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.7/1.7 MB\u001b[0m \u001b[31m52.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
132
- "\u001b[?25hCollecting backoff<3.0,>=2.0 (from cohere<5,>=4->langchain[llms])\n",
133
- " Downloading backoff-2.2.1-py3-none-any.whl (15 kB)\n",
134
- "Collecting fastavro==1.8.2 (from cohere<5,>=4->langchain[llms])\n",
135
- " Downloading fastavro-1.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB)\n",
136
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.7/2.7 MB\u001b[0m \u001b[31m61.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
137
- "\u001b[?25hRequirement already satisfied: importlib_metadata<7.0,>=6.0 in /usr/local/lib/python3.10/dist-packages (from cohere<5,>=4->langchain[llms]) (6.8.0)\n",
138
- "Requirement already satisfied: urllib3<3,>=1.26 in /usr/local/lib/python3.10/dist-packages (from cohere<5,>=4->langchain[llms]) (2.0.4)\n",
139
- "Collecting marshmallow<4.0.0,>=3.18.0 (from dataclasses-json<0.6.0,>=0.5.7->langchain[llms])\n",
140
- " Downloading marshmallow-3.20.1-py3-none-any.whl (49 kB)\n",
141
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.4/49.4 kB\u001b[0m \u001b[31m5.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
142
- "\u001b[?25hCollecting typing-inspect<1,>=0.4.0 (from dataclasses-json<0.6.0,>=0.5.7->langchain[llms])\n",
143
- " Downloading typing_inspect-0.9.0-py3-none-any.whl (8.8 kB)\n",
144
- "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface_hub<1,>=0->langchain[llms]) (3.12.2)\n",
145
- "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from huggingface_hub<1,>=0->langchain[llms]) (2023.6.0)\n",
146
- "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub<1,>=0->langchain[llms]) (4.7.1)\n",
147
- "Collecting dill>=0.3.5 (from manifest-ml<0.0.2,>=0.0.1->langchain[llms])\n",
148
- " Downloading dill-0.3.7-py3-none-any.whl (115 kB)\n",
149
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m115.3/115.3 kB\u001b[0m \u001b[31m10.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
150
- "\u001b[?25hCollecting redis>=4.3.1 (from manifest-ml<0.0.2,>=0.0.1->langchain[llms])\n",
151
- " Downloading redis-5.0.0-py3-none-any.whl (250 kB)\n",
152
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m250.1/250.1 kB\u001b[0m \u001b[31m21.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
153
- "\u001b[?25hCollecting sqlitedict>=2.0.0 (from manifest-ml<0.0.2,>=0.0.1->langchain[llms])\n",
154
- " Downloading sqlitedict-2.1.0.tar.gz (21 kB)\n",
155
- " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
156
- "Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic<3,>=1->langchain[llms]) (0.5.0)\n",
157
- "Requirement already satisfied: pydantic-core==2.6.1 in /usr/local/lib/python3.10/dist-packages (from pydantic<3,>=1->langchain[llms]) (2.6.1)\n",
158
- "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2->langchain[llms]) (3.4)\n",
159
- "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2->langchain[llms]) (2023.7.22)\n",
160
- "Requirement already satisfied: greenlet!=0.4.17 in /usr/local/lib/python3.10/dist-packages (from SQLAlchemy<3,>=1.4->langchain[llms]) (2.0.2)\n",
161
- "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch<3,>=1->langchain[llms]) (1.12)\n",
162
- "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch<3,>=1->langchain[llms]) (3.1)\n",
163
- "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch<3,>=1->langchain[llms]) (3.1.2)\n",
164
- "Requirement already satisfied: triton==2.0.0 in /usr/local/lib/python3.10/dist-packages (from torch<3,>=1->langchain[llms]) (2.0.0)\n",
165
- "Requirement already satisfied: cmake in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch<3,>=1->langchain[llms]) (3.27.2)\n",
166
- "Requirement already satisfied: lit in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch<3,>=1->langchain[llms]) (16.0.6)\n",
167
- "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers<5,>=4->langchain[llms]) (2023.6.3)\n",
168
- "Collecting tokenizers!=0.11.3,<0.14,>=0.11.1 (from transformers<5,>=4->langchain[llms])\n",
169
- " Downloading tokenizers-0.13.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.8 MB)\n",
170
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.8/7.8 MB\u001b[0m \u001b[31m37.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
171
- "\u001b[?25hCollecting safetensors>=0.3.1 (from transformers<5,>=4->langchain[llms])\n",
172
- " Downloading safetensors-0.3.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)\n",
173
- "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m27.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
174
- "\u001b[?25hRequirement already satisfied: grpcio>=1.44.0 in /usr/local/lib/python3.10/dist-packages (from clarifai-grpc>=9.7.4->clarifai>=9.1.0->langchain[llms]) (1.57.0)\n",
175
- "Requirement already satisfied: protobuf>=3.20.3 in /usr/local/lib/python3.10/dist-packages (from clarifai-grpc>=9.7.4->clarifai>=9.1.0->langchain[llms]) (3.20.3)\n",
176
- "Requirement already satisfied: googleapis-common-protos>=1.53.0 in /usr/local/lib/python3.10/dist-packages (from clarifai-grpc>=9.7.4->clarifai>=9.1.0->langchain[llms]) (1.60.0)\n",
177
- "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.10/dist-packages (from importlib_metadata<7.0,>=6.0->cohere<5,>=4->langchain[llms]) (3.16.2)\n",
178
- "Collecting mypy-extensions>=0.3.0 (from typing-inspect<1,>=0.4.0->dataclasses-json<0.6.0,>=0.5.7->langchain[llms])\n",
179
- " Downloading mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)\n",
180
- "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch<3,>=1->langchain[llms]) (2.1.3)\n",
181
- "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->torch<3,>=1->langchain[llms]) (1.3.0)\n",
182
- "Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.10/dist-packages (from markdown-it-py>=2.2.0->rich==13.4.2->clarifai>=9.1.0->langchain[llms]) (0.1.2)\n",
183
- "Building wheels for collected packages: sqlitedict\n",
184
- " Building wheel for sqlitedict (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
185
- " Created wheel for sqlitedict: filename=sqlitedict-2.1.0-py3-none-any.whl size=16864 sha256=cdaf41148555f6578da2a30ccc054f73dfa27c63fb8843f1f8e089617929d516\n",
186
- " Stored in directory: /root/.cache/pip/wheels/79/d6/e7/304e0e6cb2221022c26d8161f7c23cd4f259a9e41e8bbcfabd\n",
187
- "Successfully built sqlitedict\n",
188
- "Installing collected packages: tokenizers, sqlitedict, safetensors, tqdm, redis, python-rapidjson, mypy-extensions, marshmallow, fastavro, dill, backoff, typing-inspect, tritonclient, rich, openlm, nlpcloud, manifest-ml, clarifai-grpc, transformers, openai, langsmith, dataclasses-json, cohere, clarifai, langchain\n",
189
- " Attempting uninstall: tqdm\n",
190
- " Found existing installation: tqdm 4.66.1\n",
191
- " Uninstalling tqdm-4.66.1:\n",
192
- " Successfully uninstalled tqdm-4.66.1\n",
193
- " Attempting uninstall: rich\n",
194
- " Found existing installation: rich 13.5.2\n",
195
- " Uninstalling rich-13.5.2:\n",
196
- " Successfully uninstalled rich-13.5.2\n",
197
- "Successfully installed backoff-2.2.1 clarifai-9.7.6 clarifai-grpc-9.8.0 cohere-4.22 dataclasses-json-0.5.14 dill-0.3.7 fastavro-1.8.2 langchain-0.0.281 langsmith-0.0.33 manifest-ml-0.0.1 marshmallow-3.20.1 mypy-extensions-1.0.0 nlpcloud-1.1.44 openai-0.28.0 openlm-0.0.5 python-rapidjson-1.10 redis-5.0.0 rich-13.4.2 safetensors-0.3.3 sqlitedict-2.1.0 tokenizers-0.13.3 tqdm-4.64.1 transformers-4.33.0 tritonclient-2.34.0 typing-inspect-0.9.0\n"
198
- ]
199
- }
200
- ]
201
- },
202
- {
203
- "cell_type": "code",
204
- "source": [
205
- "import gradio as gr\n",
206
- "from transformers import pipeline\n",
207
- "\n",
208
- "generator = pipeline('text-generation', model='gpt2')\n",
209
- "\n",
210
- "def generate(text):\n",
211
- " result = generator(text, max_length=30, num_return_sequences=1)\n",
212
- " return result[0][\"generated_text\"]\n",
213
- "\n",
214
- "examples = [\n",
215
- " [\"The Moon's orbit around Earth has\"],\n",
216
- " [\"The smooth Borealis basin in the Northern Hemisphere covers 40%\"],\n",
217
- "]\n",
218
- "\n",
219
- "demo = gr.Interface(\n",
220
- " fn=generate,\n",
221
- " inputs=gr.inputs.Textbox(lines=5, label=\"Input Text\"),\n",
222
- " outputs=gr.outputs.Textbox(label=\"Generated Text\"),\n",
223
- " examples=examples,\n",
224
- " theme=\"\"\n",
225
- ")\n",
226
- "\n",
227
- "demo.launch(share=True)"
228
- ],
229
- "metadata": {
230
- "colab": {
231
- "base_uri": "https://localhost:8080/",
232
- "height": 750
233
- },
234
- "id": "asT1hDb_A2r9",
235
- "outputId": "27ac4151-a062-4910-d876-32d4e65084ec"
236
- },
237
- "execution_count": 79,
238
- "outputs": [
239
- {
240
- "output_type": "stream",
241
- "name": "stderr",
242
- "text": [
243
- "<ipython-input-79-510ccec6f36e>:17: GradioDeprecationWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
244
- " inputs=gr.inputs.Textbox(lines=5, label=\"Input Text\"),\n",
245
- "<ipython-input-79-510ccec6f36e>:17: GradioDeprecationWarning: `optional` parameter is deprecated, and it has no effect\n",
246
- " inputs=gr.inputs.Textbox(lines=5, label=\"Input Text\"),\n",
247
- "<ipython-input-79-510ccec6f36e>:17: GradioDeprecationWarning: `numeric` parameter is deprecated, and it has no effect\n",
248
- " inputs=gr.inputs.Textbox(lines=5, label=\"Input Text\"),\n",
249
- "<ipython-input-79-510ccec6f36e>:18: GradioDeprecationWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
250
- " outputs=gr.outputs.Textbox(label=\"Generated Text\"),\n"
251
- ]
252
- },
253
- {
254
- "output_type": "stream",
255
- "name": "stdout",
256
- "text": [
257
- "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n",
258
- "Running on public URL: https://4edd45cf3f6ca5ecbf.gradio.live\n",
259
- "\n",
260
- "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n"
261
- ]
262
- },
263
- {
264
- "output_type": "display_data",
265
- "data": {
266
- "text/plain": [
267
- "<IPython.core.display.HTML object>"
268
- ],
269
- "text/html": [
270
- "<div><iframe src=\"https://4edd45cf3f6ca5ecbf.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
271
- ]
272
- },
273
- "metadata": {}
274
- },
275
- {
276
- "output_type": "execute_result",
277
- "data": {
278
- "text/plain": []
279
- },
280
- "metadata": {},
281
- "execution_count": 79
282
- }
283
- ]
284
- }
285
- ]
286
- }