rajkstats commited on
Commit
8575501
โ€ข
1 Parent(s): d224dcb

updated readme

Browse files
Files changed (1) hide show
  1. README.md +167 -1
README.md CHANGED
@@ -8,4 +8,170 @@ pinned: false
8
  license: openrail
9
  ---
10
 
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  license: openrail
9
  ---
10
 
11
+ > 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!
12
+
13
+ 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.
14
+
15
+ - ๐Ÿค Breakout Room #1:
16
+ 1. Getting Started
17
+ 2. Setting Environment Variables
18
+ 3. Using the OpenAI Python Library
19
+ 4. Prompt Engineering Principles
20
+ 5. Testing Your Prompt
21
+
22
+ Complete the notebook in this repository, or head to [this notebook](https://colab.research.google.com/drive/1VMyF3WOCETYbRx01z99QBjycB4cRwquv?usp=sharing) and follow along with the instructions!
23
+
24
+
25
+ - ๐Ÿค Breakout Room #2:
26
+ 1. ๐Ÿ—๏ธ Building Your First LLM App
27
+ 3. ๐Ÿณ Containerizing our App
28
+ 4. ๐Ÿš€ Deploying Your First LLM App
29
+
30
+ <details>
31
+ <summary>๐Ÿ—๏ธ Building Your First LLM App</summary>
32
+
33
+ 1. Clone [this](https://github.com/AI-Maker-Space/Beyond-ChatGPT/tree/main) repo.
34
+
35
+ ``` bash
36
+ git clone https://github.com/AI-Maker-Space/Beyond-ChatGPT.git
37
+ ```
38
+
39
+ 2. Navigate inside this repo
40
+ ``` bash
41
+ cd Beyond-ChatGPT
42
+ ```
43
+
44
+ 3. Install the packages required for this python envirnoment in `requirements.txt`.
45
+ ``` bash
46
+ pip install -r requirements.txt
47
+ ```
48
+
49
+ 4. Open your `.env` file. Replace the `###` in your `.env` file with your OpenAI Key and save the file.
50
+ ``` bash
51
+ OPENAI_API_KEY=sk-###
52
+ ```
53
+
54
+ 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.
55
+ ``` bash
56
+ chainlit run app.py -w
57
+ ```
58
+
59
+ <p align = "center" draggable=โ€falseโ€>
60
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/54bcccf9-12e2-4cef-ab53-585c1e2b0fb5">
61
+ </p>
62
+
63
+ Great work! Let's see if we can interact with our chatbot.
64
+
65
+ <p align = "center" draggable=โ€falseโ€>
66
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/854e4435-1dee-438a-9146-7174b39f7c61">
67
+ </p>
68
+
69
+ Awesome! Time to throw it into a docker container and prepare it for shipping!
70
+ </details>
71
+
72
+
73
+
74
+ <details>
75
+ <summary>๐Ÿณ Containerizing our App</summary>
76
+
77
+ 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.
78
+
79
+ ``` bash
80
+ docker build -t llm-app .
81
+ ```
82
+
83
+ 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.
84
+
85
+ ``` bash
86
+ docker run -p 7860:7860 llm-app
87
+ ```
88
+
89
+ 3. Visit http://localhost:7860 in your browser to see if the app runs correctly.
90
+
91
+ <p align = "center" draggable=โ€falseโ€>
92
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/2c764f25-09a0-431b-8d28-32246e0ca1b7">
93
+ </p>
94
+
95
+ Great! Time to ship!
96
+ </details>
97
+
98
+
99
+ <details>
100
+ <summary>๐Ÿš€ Deploying Your First LLM App</summary>
101
+
102
+ 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`.
103
+
104
+ <p align = "center" draggable=โ€falseโ€>
105
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/f0656408-28b8-4876-9887-8f0c4b882bae">
106
+ </p>
107
+
108
+ 2. Setup your space as shown below:
109
+
110
+ - Owner: Your username
111
+ - Space Name: `llm-app`
112
+ - License: `Openrail`
113
+ - Select the Space SDK: `Docker`
114
+ - Docker Template: `Blank`
115
+ - Space Hardware: `CPU basic - 2 vCPU - 16 GB - Free`
116
+ - Repo type: `Public`
117
+
118
+ <p align = "center" draggable=โ€falseโ€>
119
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/8f16afd1-6b46-4d9f-b642-8fefe355c5c9">
120
+ </p>
121
+
122
+ 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.
123
+
124
+ <p align = "center" draggable=โ€falseโ€>
125
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/cbf366e2-7613-4223-932a-72c67a73f9c6">
126
+ </p>
127
+
128
+ 4. After pushing all files, navigate to the settings in the top right to add your OpenAI API key.
129
+
130
+ <p align = "center" draggable=โ€falseโ€>
131
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/a1123a6f-abdd-4f76-bea4-39acf9928762">
132
+ </p>
133
+
134
+ 5. Scroll down to `Variables and secrets` and click on `New secret` on the top right.
135
+
136
+ <p align = "center" draggable=โ€falseโ€>
137
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/a8a4a25d-752b-4036-b572-93381370c2db">
138
+ </p>
139
+
140
+ 6. Set the name to `OPENAI_API_KEY` and add your OpenAI key under `Value`. Click save.
141
+
142
+ <p align = "center" draggable=โ€falseโ€>
143
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/0a897538-1779-48ff-bcb4-486af30f7a14">
144
+ </p>
145
+
146
+ 7. To ensure your key is being used, we recommend you `Restart this Space`.
147
+
148
+ <p align = "center" draggable=โ€falseโ€>
149
+ <img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/fb1d83af-6ebe-4676-8bf5-b6d88f07c583">
150
+ </p>
151
+
152
+ 8. Congratulations! You just deployed your first LLM Application! ๐Ÿš€๐Ÿš€๐Ÿš€ Get on LinkedIn and post your results and experience! Make sure to tag us at #AIMakerspace !
153
+
154
+ Here's a template to get your post started!
155
+
156
+ ```
157
+ ๐Ÿš€๐ŸŽ‰ Exciting News! ๐ŸŽ‰๐Ÿš€
158
+
159
+ ๐Ÿ—๏ธย 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! ๐Ÿ–ฅ๏ธ
160
+
161
+ Check it out ๐Ÿ‘‡
162
+ [LINK TO APP]
163
+
164
+ A big shoutout to the @**AI Makerspace** for all making this possible. Couldn't have done it without the incredible community there. ๐Ÿค—๐Ÿ™
165
+
166
+ Looking forward to building with the community! ๐Ÿ™Œโœจย Here's to many more creations ahead! ๐Ÿฅ‚๐ŸŽ‰
167
+
168
+ Who else is diving into the world of AI? Let's connect! ๐ŸŒ๐Ÿ’ก
169
+
170
+ #FirstLLM #Chainlit #Docker #OpenAI #AIMakerspace
171
+ ```
172
+
173
+ </details>
174
+
175
+ <p></p>
176
+
177
+ ### That's it for now! And so it begins.... :)