1
00:00:05,510 --> 00:00:14,150
In this lesson, we are going to talk about some basic, uh, concepts around Streamlit.

2
00:00:21,390 --> 00:00:30,660
So the first thing we need to highlight is that when a we are working with level two applications,

3
00:00:30,660 --> 00:00:36,330
we are going to be using code editors, not Jupyter notebooks.

4
00:00:36,330 --> 00:00:47,310
So if you remember in the A in the previous phase when we were building level one applications, we

5
00:00:47,310 --> 00:00:49,470
were using Jupyter notebooks.

6
00:00:49,470 --> 00:00:57,510
Jupyter notebooks are very useful tools for us because they allow us to write code and also explanatory

7
00:00:57,510 --> 00:00:59,880
text in a in a very easy way.

8
00:00:59,880 --> 00:01:06,660
So they are very good, you know, for explaining a new, new, new things to, to students.

9
00:01:07,260 --> 00:01:15,690
But when we start progressing towards more professional applications, we are going to use more the

10
00:01:15,690 --> 00:01:19,380
code editors and less the Jupyter notebooks.

11
00:01:19,380 --> 00:01:30,270
So in this block of a level two applications, we are going to use a code editor a in our case we use

12
00:01:30,270 --> 00:01:32,070
Visual Studio Code.

13
00:01:32,100 --> 00:01:38,250
This is a free editor, free code editor from Microsoft.

14
00:01:38,250 --> 00:01:46,230
And this is the one we recommend you because a a a a.

15
00:01:47,140 --> 00:01:54,070
First is the most used, uh, overall in the in the, in the real world.

16
00:01:54,070 --> 00:02:01,960
So it is very probable that if you are applying for a job in, in, in a company, they are using Visual

17
00:02:01,960 --> 00:02:03,160
Studio Code.

18
00:02:03,220 --> 00:02:13,450
And the second reason why we recommend Visual Studio Code is that Visual Studio Code has now some advantages.

19
00:02:13,570 --> 00:02:19,030
Uh, in a compared with other editors.

20
00:02:19,180 --> 00:02:24,700
Uh, especially in the area of artificial intelligence assistance.

21
00:02:24,700 --> 00:02:31,960
So if you remember, we have been talking about ChatGPT before and the value it is going to have for

22
00:02:31,960 --> 00:02:37,600
you in this stage, in this stage, in this learning stage.

23
00:02:37,780 --> 00:02:45,640
Uh, as an code assistant and general assistant, if you want, we use GPT four on a daily basis.

24
00:02:46,540 --> 00:02:53,290
But there are other artificial intelligence tools that software engineers use while working on a daily

25
00:02:53,290 --> 00:03:00,070
basis, and one of the most popular ones is GitHub, a co-pilot.

26
00:03:00,070 --> 00:03:08,500
So GitHub Copilot in some cases is like an alternative to ChatGPT for.

27
00:03:08,500 --> 00:03:13,930
So some people use ChatGPT for, some people use GitHub Copilot.

28
00:03:13,930 --> 00:03:24,250
But the more professional you are and the more a, uh, hardcore, um, software engineer you are,

29
00:03:24,340 --> 00:03:31,810
usually the more you are going to use GitHub copilot, unless you are going to use ChatGPT for.

30
00:03:31,810 --> 00:03:37,360
So just because of that, we recommend Visual Studio Code, okay.

31
00:03:37,360 --> 00:03:41,110
Because you are going to see that in your job interviews.

32
00:03:41,110 --> 00:03:44,950
It's going to be better for you to have experience with Visual Studio Code.

33
00:03:44,950 --> 00:03:47,440
And because it is extensible.

34
00:03:47,440 --> 00:03:51,910
So it can use other tools like a GitHub copilot.

35
00:03:51,910 --> 00:03:59,830
So remember, we don't have any kind of sponsor or sponsorship deal or whatever with any brand.

36
00:03:59,830 --> 00:04:07,570
We only recommend you the tools and the brands we think are the best for you in terms of quality and

37
00:04:07,570 --> 00:04:08,890
in terms of cost.

38
00:04:08,890 --> 00:04:09,220
Okay.

39
00:04:09,220 --> 00:04:13,450
So in this case our recommendation is going to be Visual Studio Code.

40
00:04:13,450 --> 00:04:15,190
Visual Studio Code is free.

41
00:04:15,190 --> 00:04:17,950
You can download it on the internet.

42
00:04:17,950 --> 00:04:19,750
You have any doubt or problems.

43
00:04:19,750 --> 00:04:24,190
Just go to ChatGPT four and ask there, uh, whatever.

44
00:04:24,930 --> 00:04:32,400
Second important thing about the Streamlit apps we are going to build in this stage.

45
00:04:32,730 --> 00:04:37,470
The structure of these apps is extremely simple.

46
00:04:37,620 --> 00:04:41,550
They only have three files.

47
00:04:42,710 --> 00:04:50,870
They have one file where you, uh, store the main logic of the application, and you will see that

48
00:04:50,870 --> 00:05:00,680
this main file is going to be very similar to the the notebooks you have been writing in the, in the

49
00:05:00,680 --> 00:05:02,420
level one applications.

50
00:05:02,480 --> 00:05:10,310
Uh, in this case, uh, instead of having a notebook, we are going to have a, uh, file.

51
00:05:10,820 --> 00:05:12,980
It's going to be a Python file.

52
00:05:13,370 --> 00:05:18,800
And the name of the Python file is going to be main dot pi.

53
00:05:18,830 --> 00:05:25,100
Pi pi Pi is the ending we use for the Python files.

54
00:05:25,130 --> 00:05:25,520
Okay.

55
00:05:25,520 --> 00:05:31,970
So you open your Visual Studio Code and you create a new file called main dot pi.

56
00:05:32,930 --> 00:05:35,690
You will not have to do this for the exercises.

57
00:05:35,690 --> 00:05:43,700
For the exercises, you just open your Visual Studio code and open the the exercises files we provide

58
00:05:43,700 --> 00:05:43,880
you.

59
00:05:43,880 --> 00:05:53,270
So you will see in each of the apps you have a main.py, a file, a requirements.txt file, and a dot

60
00:05:53,270 --> 00:05:53,870
m file.

61
00:05:53,870 --> 00:05:55,550
Well, in case the.

62
00:05:55,550 --> 00:06:03,950
In this case, the dot m file is not going to be in each of the exercises, the dot m file should be

63
00:06:03,950 --> 00:06:12,890
in the root folder, and you will have to create your own dot m file with your own credentials.

64
00:06:12,890 --> 00:06:21,950
We have provided a sample of the dot m file in the GitHub repository, but as you remember, this is

65
00:06:21,950 --> 00:06:28,760
just a sample a only with the name of the of the credentials, but not with the credentials itself,

66
00:06:28,760 --> 00:06:34,820
but just for you to have a sense of the the format that you will have to use.

67
00:06:34,970 --> 00:06:38,600
So about the structure of the project.

68
00:06:39,500 --> 00:06:46,580
He's going to have a Streamlit application is going to have three files the Dotenv, the Main.py and

69
00:06:46,580 --> 00:06:49,310
the requirements dot txt.

70
00:06:50,510 --> 00:07:01,760
The last one, the requirements.txt, is where we are going to enter the name of the packages that it

71
00:07:01,760 --> 00:07:07,370
will need to download in order to make the level two application work.

72
00:07:07,670 --> 00:07:18,440
Okay, so instead of a installing the modules, first we include the modules in the requirements.txt

73
00:07:18,440 --> 00:07:19,220
file.

74
00:07:19,220 --> 00:07:26,360
And when you execute the Streamlit application these modules are automatically loaded.

75
00:07:26,390 --> 00:07:27,020
Okay.

76
00:07:27,140 --> 00:07:35,540
So in this file requirements.txt is where we can be more or less careful.

77
00:07:36,330 --> 00:07:42,840
If we are less careful as we are whenever we work with a demo is something that we are not going to

78
00:07:42,840 --> 00:07:47,820
dedicate a lot of time, we just write the name of the package.

79
00:07:47,820 --> 00:07:56,850
So if we want to, uh, if we want to, uh, load the long chain OpenAI package, we will say long chain

80
00:07:56,850 --> 00:07:57,660
OpenAI.

81
00:07:57,750 --> 00:08:07,680
But here in the requirements.txt, you can be more careful, more specific, and include exactly the

82
00:08:07,680 --> 00:08:10,440
version of the package you want.

83
00:08:10,830 --> 00:08:15,780
Okay, so this is what we do in the professional applications.

84
00:08:15,780 --> 00:08:24,300
We are very careful about the version of each package we load in our application, because we don't

85
00:08:24,300 --> 00:08:31,650
want to use different, uh, versions of our packages because this may break your application.

86
00:08:31,650 --> 00:08:32,220
Okay.

87
00:08:32,220 --> 00:08:37,080
But in the case of our exercises, these are just very simple demos.

88
00:08:37,080 --> 00:08:41,370
We are just going to use the name of each package as you will see.

89
00:08:41,370 --> 00:08:51,210
So remember in this exercises the structure of the level two application is going to have two files.

90
00:08:51,210 --> 00:08:55,770
Because the dot m file is supposed to be in the root folder.

91
00:08:55,770 --> 00:09:04,650
Okay a but you will need to have a dot m file for most of these level two applications, because you

92
00:09:04,650 --> 00:09:09,600
will need the OpenAI K in the in most of the cases.

93
00:09:09,780 --> 00:09:13,320
And this OpenAI K is your OpenAI K.

94
00:09:13,320 --> 00:09:18,660
And you should store this OpenAI K in a dot m file that you create.

95
00:09:18,660 --> 00:09:27,930
So remember basic structure that open file requirements.txt and the main.py which is the the file with

96
00:09:27,930 --> 00:09:30,120
the main logic of the application.

97
00:09:30,120 --> 00:09:30,630
Don't worry.

98
00:09:30,630 --> 00:09:34,860
We are going to see this in practice in the next lessons.

99
00:09:34,860 --> 00:09:41,760
But this just a quick introduction about the basic structure of a Streamlit application.

100
00:09:42,300 --> 00:09:46,440
Second thing about the Streamlit operations.

101
00:09:46,590 --> 00:09:54,750
In the attached document, we are going to provide the URL where you can find the quick introduction

102
00:09:54,750 --> 00:09:57,120
that extremely provides.

103
00:09:57,120 --> 00:10:05,940
And this is the best way, uh, for you to have your initial experience with Streamlit there.

104
00:10:05,940 --> 00:10:08,160
You will learn that extremely.

105
00:10:08,160 --> 00:10:15,330
It is very simple, very basic, very easy and quick to to learn.

106
00:10:15,810 --> 00:10:22,740
And you will see that the main things we are going to use in our applications are just 4 or 5 things

107
00:10:22,740 --> 00:10:29,820
we are going to use some titles we are going to use some sidebars, we are going to use some forms and

108
00:10:29,820 --> 00:10:32,040
some buttons and that's it.

109
00:10:33,290 --> 00:10:41,480
So you will see good examples in a very, very easy and quick tutorial in Streamlit.

110
00:10:41,480 --> 00:10:43,400
In the URL we provide.

111
00:10:43,760 --> 00:10:52,070
You will see there as well that you can run your Streamlit application locally in your computer and

112
00:10:52,070 --> 00:10:53,600
also in the cloud.

113
00:10:53,600 --> 00:11:01,010
In the Streamlit Cloud, the Streamlit cloud is free and is very convenient because it's where you can

114
00:11:01,010 --> 00:11:09,680
share your Streamlit application with others, so you can provide the URL of the Streamlit application

115
00:11:09,680 --> 00:11:14,720
in the cloud, and any other person you know from wherever they are.

116
00:11:14,720 --> 00:11:19,010
They can access this Streamlit app from the internet.

117
00:11:19,010 --> 00:11:19,220
Right.

118
00:11:19,220 --> 00:11:20,930
So this is this is very good.

119
00:11:20,930 --> 00:11:27,590
So you will see that there is a way to execute an extremely application from your computer.

120
00:11:27,590 --> 00:11:32,720
And there is a different way to execute a Streamlit application when it is in the cloud.

121
00:11:32,720 --> 00:11:38,180
We will tell you a little bit more about that later, but you are going to see this in the Streamlit

122
00:11:38,210 --> 00:11:52,460
tutorial and we give you this link in purpose instead of explaining all the details, uh, ourselves.

123
00:11:52,460 --> 00:11:53,120
Why?

124
00:11:53,120 --> 00:12:01,400
Because this is the way and, uh, artificial intelligence engineer is going to work in the real world.

125
00:12:01,400 --> 00:12:08,180
So the same, uh, way that we recommended you to work with GPT four.

126
00:12:08,180 --> 00:12:14,060
And in many cases, we are going to tell you, you have any doubt or any problem, just go to chat GPT

127
00:12:14,090 --> 00:12:15,350
four and ask.

128
00:12:15,860 --> 00:12:24,050
We are recommending you in this moment to go to the Streamlit documentation page and take a look at

129
00:12:24,050 --> 00:12:25,970
their own tutorial.

130
00:12:26,510 --> 00:12:33,410
You will see it's very basic, very easy to understand, but you will also realize the way we artificial

131
00:12:33,410 --> 00:12:35,810
intelligence engineers work every day.

132
00:12:35,810 --> 00:12:44,720
So whenever you every day, every day, we are faced with new tools, uh, with new ways to solve problems,

133
00:12:44,720 --> 00:12:49,790
with new lessons that we need to learn, new frameworks, etc..

134
00:12:49,790 --> 00:12:57,320
And one of the things we do on a daily basis is know new frameworks, new new devices, go to their

135
00:12:57,320 --> 00:13:00,320
documentation page and understand how they work.

136
00:13:00,320 --> 00:13:04,640
So this is something you are going to do on a daily basis.

137
00:13:04,640 --> 00:13:10,430
So it's a very good occasion for you to start, uh, trying uh, this process with extremely.

138
00:13:11,640 --> 00:13:18,660
A some very quick notes about terminal operations with Streamlit application.

139
00:13:18,660 --> 00:13:29,610
So if you execute your Streamlit application from your computer and the the main instructions to do

140
00:13:29,610 --> 00:13:32,340
so will be from the terminal.

141
00:13:32,340 --> 00:13:39,900
Remember we have been talking about the terminal in a previous lesson in this case a to run a Streamlit

142
00:13:39,900 --> 00:13:45,750
application, you only need 3 or 4 uh instructions in the terminal.

143
00:13:45,750 --> 00:13:48,960
First you are going to create a virtual environment.

144
00:13:48,960 --> 00:13:51,930
This is optional but highly recommended.

145
00:13:52,530 --> 00:14:01,260
Then you are going to install the packages that are in the requirements.txt file.

146
00:14:01,260 --> 00:14:03,630
And you will see that this is very easy.

147
00:14:03,630 --> 00:14:11,610
You go to the folder where with where the Streamlit application is and you just write pip install a

148
00:14:11,610 --> 00:14:15,030
requirements.txt in your terminal and that's it.

149
00:14:15,030 --> 00:14:23,040
Well you will see the, the, the, the instructions in the attached document is pip install hyphen

150
00:14:23,040 --> 00:14:25,110
r requirements.txt.

151
00:14:25,140 --> 00:14:25,890
Exactly.

152
00:14:25,890 --> 00:14:34,140
And finally you will execute the application by writing a Streamlit run.

153
00:14:34,140 --> 00:14:35,700
Main.py.

154
00:14:35,730 --> 00:14:36,390
That's it.

155
00:14:36,390 --> 00:14:41,520
So super simple as always your operations in terminal.

156
00:14:42,800 --> 00:14:53,630
Finally, a quick note about loading the Streamlit app in the cloud so extremely it provides a free

157
00:14:53,660 --> 00:14:55,820
hosting service for you.

158
00:14:55,910 --> 00:15:00,560
These hosting services is good but is not excellent.

159
00:15:00,680 --> 00:15:02,330
Why do we say that?

160
00:15:02,330 --> 00:15:07,820
Because this a cloud hosting is like temporary.

161
00:15:08,360 --> 00:15:16,160
So for example, when you uh, when you visit, uh, some of the apps we provide in this section.

162
00:15:16,980 --> 00:15:24,480
You will see that we are going to provide a link so you can check these applications online.

163
00:15:24,540 --> 00:15:31,260
And in some cases you will see that when you try to access the application in the Streamlit cloud,

164
00:15:31,260 --> 00:15:37,560
you are going to see some kind of a screen telling you that the app is sleeping.

165
00:15:37,740 --> 00:15:38,850
Why is that?

166
00:15:38,850 --> 00:15:51,570
Because Streamlit has a very nasty way to, uh uh, drop your apps when, uh, they have a low number

167
00:15:51,570 --> 00:15:52,650
of users.

168
00:15:52,650 --> 00:15:59,460
And if they don't have a lot of activity, which is in most cases when you are working with demos,

169
00:15:59,670 --> 00:16:06,630
uh, your user is going to find this screen saying, oh, you know, this app is sleeping.

170
00:16:06,630 --> 00:16:09,450
If you want to wake up this app, click here.

171
00:16:09,450 --> 00:16:18,210
So it's not very professional, but it's the way they have, uh, to save, you know, uh, space and

172
00:16:18,210 --> 00:16:19,530
computing power etc..

173
00:16:19,530 --> 00:16:21,300
So the service is free.

174
00:16:21,300 --> 00:16:22,590
So it's it's okay.

175
00:16:22,590 --> 00:16:23,010
Right.

176
00:16:23,010 --> 00:16:33,570
So in order to publish your app on Streamlit Cloud, after you have built a Streamlit app, a to show

177
00:16:33,570 --> 00:16:42,720
it off to the world, you can use the Streamlit Community Cloud to deploy, manage and share your application

178
00:16:42,720 --> 00:16:43,440
for free.

179
00:16:44,380 --> 00:16:49,390
And you will see it works in three simple steps.

180
00:16:49,960 --> 00:16:55,510
First, you put your app in a public GitHub repository.

181
00:16:56,350 --> 00:17:03,430
Second, you sign into the Streamlit Community Cloud.

182
00:17:03,460 --> 00:17:11,800
And finally, you just click deploy an app and then paste in your GitHub URL.

183
00:17:11,829 --> 00:17:13,480
Okay, so very simple.

184
00:17:13,480 --> 00:17:18,579
You just load your application from your computer to your GitHub repository.

185
00:17:18,609 --> 00:17:22,960
You just sign in into the Streamlit Community Cloud.

186
00:17:22,960 --> 00:17:28,600
You integrate your GitHub account with the Streamlit account.

187
00:17:28,600 --> 00:17:37,000
And then you can select whatever project, uh, to deploy into the Streamlit cloud from your GitHub

188
00:17:37,000 --> 00:17:37,840
repository.

189
00:17:37,840 --> 00:17:39,040
Very easy.

190
00:17:39,040 --> 00:17:45,490
In case of doubt, you you will have very clear, uh, step by step instructions in the Streamlit tutorial.

191
00:17:45,490 --> 00:17:54,580
And also remember there you have ChatGPT for to help you with whatever doubt you may have in the process.

192
00:17:55,380 --> 00:18:03,090
So in this lesson, we have been talking briefly about Streamlit and the initial concepts around Streamlit.

193
00:18:03,210 --> 00:18:11,310
In the next lesson, we are going to provide you the links to the live applications, the Live the Life

194
00:18:11,310 --> 00:18:14,400
level two applications on Streamlit.

195
00:18:14,430 --> 00:18:21,870
We are also going to provide you the GitHub links to these level two applications code.

196
00:18:21,870 --> 00:18:25,080
And finally we will go one by one.

197
00:18:25,880 --> 00:18:26,690
2%.

198
00:18:26,690 --> 00:18:32,870
The code and the demo for each of these level two applications.

