sushantgo commited on
Commit
7c24e56
1 Parent(s): 1042d39

Upload folder using huggingface_hub

Browse files
.ipynb_checkpoints/langchain-app-checkpoint.ipynb CHANGED
@@ -2,9 +2,40 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": null,
6
  "metadata": {},
7
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  "source": [
9
  "import os\n",
10
  "import gradio as gr\n",
@@ -45,11 +76,24 @@
45
  }
46
  ],
47
  "metadata": {
48
- "language_info": {
49
- "name": "python"
 
 
50
  },
51
- "orig_nbformat": 4
 
 
 
 
 
 
 
 
 
 
 
52
  },
53
  "nbformat": 4,
54
- "nbformat_minor": 2
55
  }
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 1,
6
  "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "Running on local URL: http://127.0.0.1:7863\n",
13
+ "Running on public URL: https://cf43e4871c9bab7308.gradio.live\n",
14
+ "\n",
15
+ "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"
16
+ ]
17
+ },
18
+ {
19
+ "data": {
20
+ "text/html": [
21
+ "<div><iframe src=\"https://cf43e4871c9bab7308.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
22
+ ],
23
+ "text/plain": [
24
+ "<IPython.core.display.HTML object>"
25
+ ]
26
+ },
27
+ "metadata": {},
28
+ "output_type": "display_data"
29
+ },
30
+ {
31
+ "data": {
32
+ "text/plain": []
33
+ },
34
+ "execution_count": 1,
35
+ "metadata": {},
36
+ "output_type": "execute_result"
37
+ }
38
+ ],
39
  "source": [
40
  "import os\n",
41
  "import gradio as gr\n",
 
76
  }
77
  ],
78
  "metadata": {
79
+ "kernelspec": {
80
+ "display_name": "Python 3 (ipykernel)",
81
+ "language": "python",
82
+ "name": "python3"
83
  },
84
+ "language_info": {
85
+ "codemirror_mode": {
86
+ "name": "ipython",
87
+ "version": 3
88
+ },
89
+ "file_extension": ".py",
90
+ "mimetype": "text/x-python",
91
+ "name": "python",
92
+ "nbconvert_exporter": "python",
93
+ "pygments_lexer": "ipython3",
94
+ "version": "3.11.4"
95
+ }
96
  },
97
  "nbformat": 4,
98
+ "nbformat_minor": 4
99
  }
.ipynb_checkpoints/simple-langchain-app-checkpoint.ipynb ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "f6f4bf16-7e46-460c-829f-702fcfc23713",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import os\n",
11
+ "import gradio as gr\n",
12
+ "from dotenv import load_dotenv, find_dotenv\n",
13
+ "_ = load_dotenv(find_dotenv())\n",
14
+ "\n",
15
+ "from langchain.chains import ConversationChain\n",
16
+ "from langchain.chat_models import ChatOpenAI\n",
17
+ "from langchain.memory import ConversationBufferMemory\n",
18
+ "\n",
19
+ "llm = ChatOpenAI(temperature=0.0)\n",
20
+ "memory = ConversationBufferMemory()\n",
21
+ "conversion = ConversationChain(\n",
22
+ " llm=llm,\n",
23
+ " memory=memory,\n",
24
+ " verbose=False\n",
25
+ ")\n",
26
+ "\n",
27
+ "def takeinput(input_str):\n",
28
+ " output_str = conversion.predict(input=input_str)\n",
29
+ " return output_str\n",
30
+ "\n",
31
+ "demo = gr.Interface(\n",
32
+ " fn=takeinput,\n",
33
+ " inputs=[\"text\"],\n",
34
+ " outputs=[\"text\"]\n",
35
+ ")\n",
36
+ "\n",
37
+ "demo.launch(share=True)\n"
38
+ ]
39
+ }
40
+ ],
41
+ "metadata": {
42
+ "kernelspec": {
43
+ "display_name": "Python 3 (ipykernel)",
44
+ "language": "python",
45
+ "name": "python3"
46
+ },
47
+ "language_info": {
48
+ "codemirror_mode": {
49
+ "name": "ipython",
50
+ "version": 3
51
+ },
52
+ "file_extension": ".py",
53
+ "mimetype": "text/x-python",
54
+ "name": "python",
55
+ "nbconvert_exporter": "python",
56
+ "pygments_lexer": "ipython3",
57
+ "version": "3.11.4"
58
+ }
59
+ },
60
+ "nbformat": 4,
61
+ "nbformat_minor": 5
62
+ }
simple-langchain-app.ipynb ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "f6f4bf16-7e46-460c-829f-702fcfc23713",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import os\n",
11
+ "import gradio as gr\n",
12
+ "from dotenv import load_dotenv, find_dotenv\n",
13
+ "_ = load_dotenv(find_dotenv())\n",
14
+ "\n",
15
+ "from langchain.chains import ConversationChain\n",
16
+ "from langchain.chat_models import ChatOpenAI\n",
17
+ "from langchain.memory import ConversationBufferMemory\n",
18
+ "\n",
19
+ "llm = ChatOpenAI(temperature=0.0)\n",
20
+ "memory = ConversationBufferMemory()\n",
21
+ "conversion = ConversationChain(\n",
22
+ " llm=llm,\n",
23
+ " memory=memory,\n",
24
+ " verbose=False\n",
25
+ ")\n",
26
+ "\n",
27
+ "def takeinput(name):\n",
28
+ " output_str = conversion.predict(input=name)\n",
29
+ " return output_str\n",
30
+ "\n",
31
+ "demo = gr.Interface(\n",
32
+ " fn=takeinput,\n",
33
+ " inputs=[\"text\"],\n",
34
+ " outputs=[\"text\"]\n",
35
+ ")\n",
36
+ "\n",
37
+ "demo.launch(share=True)\n"
38
+ ]
39
+ }
40
+ ],
41
+ "metadata": {
42
+ "kernelspec": {
43
+ "display_name": "Python 3 (ipykernel)",
44
+ "language": "python",
45
+ "name": "python3"
46
+ },
47
+ "language_info": {
48
+ "codemirror_mode": {
49
+ "name": "ipython",
50
+ "version": 3
51
+ },
52
+ "file_extension": ".py",
53
+ "mimetype": "text/x-python",
54
+ "name": "python",
55
+ "nbconvert_exporter": "python",
56
+ "pygments_lexer": "ipython3",
57
+ "version": "3.11.4"
58
+ }
59
+ },
60
+ "nbformat": 4,
61
+ "nbformat_minor": 5
62
+ }