Spaces:
Sleeping
Sleeping
gizemsarsinlar
commited on
Commit
โข
bfb56da
1
Parent(s):
c0d382f
Upload README.md
Browse files
README.md
CHANGED
@@ -1,10 +1,190 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
pinned: false
|
|
|
8 |
---
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: BeyondChatGPT Demo
|
3 |
+
emoji: ๐
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: yellow
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
+
app_port: 7860
|
9 |
---
|
10 |
|
11 |
+
<p align = "center" draggable=โfalseโ ><img src="https://github.com/AI-Maker-Space/LLM-Dev-101/assets/37101144/d1343317-fa2f-41e1-8af1-1dbb18399719"
|
12 |
+
width="200px"
|
13 |
+
height="auto"/>
|
14 |
+
</p>
|
15 |
+
|
16 |
+
|
17 |
+
## <h1 align="center" id="heading">:wave: Welcome to Beyond ChatGPT!!</h1>
|
18 |
+
|
19 |
+
For a step-by-step YouTube video walkthrough, watch this! [Deploying Chainlit app on Hugging Face](https://www.youtube.com/live/pRbbZcL0NMI?si=NAYhMZ_suAY84f06&t=2119)
|
20 |
+
|
21 |
+
![Beyond ChatGPT: Build Your First LLM Application](https://github.com/AI-Maker-Space/Beyond-ChatGPT/assets/48775140/cb7a74b8-28af-4d12-a008-8f5a51d47b4c)
|
22 |
+
|
23 |
+
## ๐ค Your First LLM App
|
24 |
+
|
25 |
+
> If you need an introduction to `git`, or information on how to set up API keys for the tools we'll be using in this repository - check out our [Interactive Dev Environment for LLM Development](https://github.com/AI-Maker-Space/Interactive-Dev-Environment-for-LLM-Development/tree/main) which has everything you'd need to get started in this repository!
|
26 |
+
|
27 |
+
In this repository, we'll walk you through the steps to create a Large Language Model (LLM) application using Chainlit, then containerize it using Docker, and finally deploy it on Huggingface Spaces.
|
28 |
+
|
29 |
+
Are you ready? Let's get started!
|
30 |
+
|
31 |
+
<details>
|
32 |
+
<summary>๐ฅ๏ธ Accessing "gpt-3.5-turbo" (ChatGPT) like a developer</summary>
|
33 |
+
|
34 |
+
1. Head to [this notebook](https://colab.research.google.com/drive/1mOzbgf4a2SP5qQj33ZxTz2a01-5eXqk2?usp=sharing) and follow along with the instructions!
|
35 |
+
|
36 |
+
2. Complete the notebook and try out your own system/assistant messages!
|
37 |
+
|
38 |
+
That's it! Head to the next step and start building your application!
|
39 |
+
|
40 |
+
</details>
|
41 |
+
|
42 |
+
|
43 |
+
<details>
|
44 |
+
<summary>๐๏ธ Building Your First LLM App</summary>
|
45 |
+
|
46 |
+
1. Clone [this](https://github.com/AI-Maker-Space/Beyond-ChatGPT/tree/main) repo.
|
47 |
+
|
48 |
+
``` bash
|
49 |
+
git clone https://github.com/AI-Maker-Space/Beyond-ChatGPT.git
|
50 |
+
```
|
51 |
+
|
52 |
+
2. Navigate inside this repo
|
53 |
+
``` bash
|
54 |
+
cd Beyond-ChatGPT
|
55 |
+
```
|
56 |
+
|
57 |
+
3. Install the packages required for this python envirnoment in `requirements.txt`.
|
58 |
+
``` bash
|
59 |
+
pip install -r requirements.txt
|
60 |
+
```
|
61 |
+
|
62 |
+
4. Open your `.env` file. Replace the `###` in your `.env` file with your OpenAI Key and save the file.
|
63 |
+
``` bash
|
64 |
+
OPENAI_API_KEY=sk-###
|
65 |
+
```
|
66 |
+
|
67 |
+
5. Let's try deploying it locally. Make sure you're in the python environment where you installed Chainlit and OpenAI. Run the app using Chainlit. This may take a minute to run.
|
68 |
+
``` bash
|
69 |
+
chainlit run app.py -w
|
70 |
+
```
|
71 |
+
|
72 |
+
<p align = "center" draggable=โfalseโ>
|
73 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/54bcccf9-12e2-4cef-ab53-585c1e2b0fb5">
|
74 |
+
</p>
|
75 |
+
|
76 |
+
Great work! Let's see if we can interact with our chatbot.
|
77 |
+
|
78 |
+
<p align = "center" draggable=โfalseโ>
|
79 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/854e4435-1dee-438a-9146-7174b39f7c61">
|
80 |
+
</p>
|
81 |
+
|
82 |
+
Awesome! Time to throw it into a docker container and prepare it for shipping!
|
83 |
+
</details>
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
<details>
|
88 |
+
<summary>๐ณ Containerizing our App</summary>
|
89 |
+
|
90 |
+
1. Let's build the Docker image. We'll tag our image as `llm-app` using the `-t` parameter. The `.` at the end means we want all of the files in our current directory to be added to our image.
|
91 |
+
|
92 |
+
``` bash
|
93 |
+
docker build -t llm-app .
|
94 |
+
```
|
95 |
+
|
96 |
+
2. Run and test the Docker image locally using the `run` command. The `-p`parameter connects our **host port #** to the left of the `:` to our **container port #** on the right.
|
97 |
+
|
98 |
+
``` bash
|
99 |
+
docker run -p 7860:7860 llm-app
|
100 |
+
```
|
101 |
+
|
102 |
+
3. Visit http://localhost:7860 in your browser to see if the app runs correctly.
|
103 |
+
|
104 |
+
<p align = "center" draggable=โfalseโ>
|
105 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/2c764f25-09a0-431b-8d28-32246e0ca1b7">
|
106 |
+
</p>
|
107 |
+
|
108 |
+
Great! Time to ship!
|
109 |
+
</details>
|
110 |
+
|
111 |
+
|
112 |
+
<details>
|
113 |
+
<summary>๐ Deploying Your First LLM App</summary>
|
114 |
+
|
115 |
+
1. Let's create a new Huggingface Space. Navigate to [Huggingface](https://huggingface.co) and click on your profile picture on the top right. Then click on `New Space`.
|
116 |
+
|
117 |
+
<p align = "center" draggable=โfalseโ>
|
118 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/f0656408-28b8-4876-9887-8f0c4b882bae">
|
119 |
+
</p>
|
120 |
+
|
121 |
+
2. Setup your space as shown below:
|
122 |
+
|
123 |
+
- Owner: Your username
|
124 |
+
- Space Name: `llm-app`
|
125 |
+
- License: `Openrail`
|
126 |
+
- Select the Space SDK: `Docker`
|
127 |
+
- Docker Template: `Blank`
|
128 |
+
- Space Hardware: `CPU basic - 2 vCPU - 16 GB - Free`
|
129 |
+
- Repo type: `Public`
|
130 |
+
|
131 |
+
<p align = "center" draggable=โfalseโ>
|
132 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/8f16afd1-6b46-4d9f-b642-8fefe355c5c9">
|
133 |
+
</p>
|
134 |
+
|
135 |
+
3. You should see something like this. We're now ready to send our files to our Huggingface Space. After cloning, move your files to this repo and push it along with your docker file. You DO NOT need to create a Dockerfile. Make sure NOT TO push your `.env` file. This should automatically be ignored.
|
136 |
+
|
137 |
+
<p align = "center" draggable=โfalseโ>
|
138 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/cbf366e2-7613-4223-932a-72c67a73f9c6">
|
139 |
+
</p>
|
140 |
+
|
141 |
+
4. After pushing all files, navigate to the settings in the top right to add your OpenAI API key.
|
142 |
+
|
143 |
+
<p align = "center" draggable=โfalseโ>
|
144 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/a1123a6f-abdd-4f76-bea4-39acf9928762">
|
145 |
+
</p>
|
146 |
+
|
147 |
+
5. Scroll down to `Variables and secrets` and click on `New secret` on the top right.
|
148 |
+
|
149 |
+
<p align = "center" draggable=โfalseโ>
|
150 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/a8a4a25d-752b-4036-b572-93381370c2db">
|
151 |
+
</p>
|
152 |
+
|
153 |
+
6. Set the name to `OPENAI_API_KEY` and add your OpenAI key under `Value`. Click save.
|
154 |
+
|
155 |
+
<p align = "center" draggable=โfalseโ>
|
156 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/0a897538-1779-48ff-bcb4-486af30f7a14">
|
157 |
+
</p>
|
158 |
+
|
159 |
+
7. To ensure your key is being used, we recommend you `Restart this Space`.
|
160 |
+
|
161 |
+
<p align = "center" draggable=โfalseโ>
|
162 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/fb1d83af-6ebe-4676-8bf5-b6d88f07c583">
|
163 |
+
</p>
|
164 |
+
|
165 |
+
8. Congratulations! You just deployed your first LLM! ๐๐๐ Get on linkedin and post your results and experience! Make sure to tag us at #AIMakerspace !
|
166 |
+
|
167 |
+
Here's a template to get your post started!
|
168 |
+
|
169 |
+
```
|
170 |
+
๐๐ Exciting News! ๐๐
|
171 |
+
|
172 |
+
๐๏ธย Today, I'm thrilled to announce that I've successfully built and shipped my first-ever LLM using the powerful combination of Chainlit, Docker, and the OpenAI API! ๐ฅ๏ธ
|
173 |
+
|
174 |
+
Check it out ๐
|
175 |
+
[LINK TO APP]
|
176 |
+
|
177 |
+
A big shoutout to the @**AI Makerspace** for all making this possible. Couldn't have done it without the incredible community there. ๐ค๐
|
178 |
+
|
179 |
+
Looking forward to building with the community! ๐โจย Here's to many more creations ahead! ๐ฅ๐
|
180 |
+
|
181 |
+
Who else is diving into the world of AI? Let's connect! ๐๐ก
|
182 |
+
|
183 |
+
#FirstLLM #Chainlit #Docker #OpenAI #AIMakerspace
|
184 |
+
```
|
185 |
+
|
186 |
+
</details>
|
187 |
+
|
188 |
+
<p></p>
|
189 |
+
|
190 |
+
### That's it for now! And so it begins.... :)
|