1
00:00:00,000 --> 00:00:04,000
So guys, we are going to continue the discussion with respect to Lange chain and hugging face integration.

2
00:00:04,000 --> 00:00:09,000
Um, in this video I'm going to show you an end to end project with the help of hugging face endpoint.

3
00:00:10,000 --> 00:00:17,000
Uh, if you remember, guys, uh, previously, uh, there was one amazing, um, end to end projects

4
00:00:17,000 --> 00:00:18,000
that we had actually created.

5
00:00:18,000 --> 00:00:18,000
Right?

6
00:00:18,000 --> 00:00:24,000
And if I talk about that specific project, it was about text summarization, where we were specifically

7
00:00:24,000 --> 00:00:28,000
using a YouTube URL or any website URL.

8
00:00:28,000 --> 00:00:32,000
It was able to summarize the entire text and give it to us, right?

9
00:00:32,000 --> 00:00:34,000
So I hope everybody remembers this.

10
00:00:34,000 --> 00:00:35,000
If you don't remember it, don't worry.

11
00:00:35,000 --> 00:00:42,000
I have copied the same content inside my ninth folder hugging face with lang chain in my app dot Pi.

12
00:00:42,000 --> 00:00:46,000
Okay, so let me just go ahead and run this quickly and then we will see that how we can.

13
00:00:46,000 --> 00:00:49,000
And over here you can see that I'm calling grok API key.

14
00:00:49,000 --> 00:00:53,000
And the model that is specifically used is uh gamma seven B.

15
00:00:53,000 --> 00:00:59,000
Right now instead of using gamma seven B, what I will do is that I will use my model from hugging face.

16
00:00:59,000 --> 00:01:00,000
Right.

17
00:01:00,000 --> 00:01:06,000
And that is also the same model that we used it over here, right, in which we discussed in our previous

18
00:01:06,000 --> 00:01:06,000
video.

19
00:01:06,000 --> 00:01:09,000
So let's first of all go this go and see this particular demo.

20
00:01:09,000 --> 00:01:12,000
So I am in my ninth hugging face with Lang chain folder.

21
00:01:12,000 --> 00:01:19,000
I will go ahead and right Streamlit run app dot pi okay so let's go ahead and see this.

22
00:01:19,000 --> 00:01:21,000
So here you will be able to see that.

23
00:01:21,000 --> 00:01:22,000
Fine.

24
00:01:22,000 --> 00:01:23,000
Uh this is my entire model.

25
00:01:23,000 --> 00:01:30,000
Or let me just copy this quickly and let me go back to my page over here.

26
00:01:30,000 --> 00:01:31,000
I will try to load it.

27
00:01:31,000 --> 00:01:31,000
Okay.

28
00:01:31,000 --> 00:01:34,000
So here is my entire page here.

29
00:01:34,000 --> 00:01:36,000
First of all, it is asking me for the grok API key.

30
00:01:36,000 --> 00:01:42,000
So I will go ahead and take my grok API key which is present in my env file.

31
00:01:42,000 --> 00:01:46,000
Sorry, grok API key, not a token, but grok API key is required.

32
00:01:46,000 --> 00:01:50,000
So I will go back over here, copy and paste it and press enter.

33
00:01:50,000 --> 00:01:50,000
Okay.

34
00:01:50,000 --> 00:01:55,000
Then I will take this particular URL okay AI versus ML versus generative AI.

35
00:01:55,000 --> 00:01:59,000
This is my video in my YouTube channel just to test it out.

36
00:02:00,000 --> 00:02:05,000
And I'll paste this link over here and I'll say, hey, summarize the content from the YouTube or website.

37
00:02:05,000 --> 00:02:11,000
And remember, right now we are using gamma two model from the um, from the API itself, from the grok

38
00:02:11,000 --> 00:02:12,000
API.

39
00:02:12,000 --> 00:02:13,000
And here you can see the entire output.

40
00:02:13,000 --> 00:02:19,000
Similarly, if you go ahead and see, uh, any other website page, right.

41
00:02:19,000 --> 00:02:24,000
Like let's say docs underscore dot dot dot lang chain.com.

42
00:02:24,000 --> 00:02:28,000
If I'm giving this particular URL in my summarize URL.

43
00:02:28,000 --> 00:02:33,000
And if I say to summarize the content from the YouTube or website, you'll be able to see that I'm able

44
00:02:33,000 --> 00:02:35,000
to get the entire summary.

45
00:02:35,000 --> 00:02:39,000
Okay, so this is perfectly fine till here.

46
00:02:39,000 --> 00:02:40,000
I think you'll be able to get it right.

47
00:02:40,000 --> 00:02:41,000
So all the information is there.

48
00:02:41,000 --> 00:02:46,000
Now, instead of using this grok API and Google Gamma two model, I will try to use Huggingface endpoint

49
00:02:46,000 --> 00:02:46,000
again.

50
00:02:46,000 --> 00:02:48,000
It is completely for free.

51
00:02:48,000 --> 00:02:50,000
Uh, with respect to some of the models that we have.

52
00:02:50,000 --> 00:02:50,000
Okay.

53
00:02:50,000 --> 00:02:53,000
So I will go over here, go back to my API.

54
00:02:53,000 --> 00:02:57,000
I will just close this because I don't want it right now okay.

55
00:02:57,000 --> 00:02:59,000
And let's see what all changes I will do over here.

56
00:02:59,000 --> 00:03:03,000
First of all you you'll be seeing that this all will be same, right?

57
00:03:03,000 --> 00:03:06,000
First of all, I will go ahead and change this API.

58
00:03:06,000 --> 00:03:06,000
Right.

59
00:03:06,000 --> 00:03:12,000
Instead of writing grok API key, I will say, hey, uh, hugging face API token.

60
00:03:12,000 --> 00:03:15,000
Okay, I'll, I'll say provide my hugging face API token.

61
00:03:15,000 --> 00:03:16,000
Okay.

62
00:03:16,000 --> 00:03:18,000
And I will write HDF over here.

63
00:03:18,000 --> 00:03:19,000
Okay.

64
00:03:19,000 --> 00:03:25,000
So first thing is this then uh, you'll be able to see that I will also make sure that I will comment

65
00:03:25,000 --> 00:03:29,000
out this particular code, because LM model I need to call with respect to that.

66
00:03:29,000 --> 00:03:34,000
Now, if I really need to call the LM model from hugging face endpoint, I need to import this library

67
00:03:34,000 --> 00:03:38,000
from long chain underscore hugging face so quickly I will go over here.

68
00:03:38,000 --> 00:03:40,000
I will import it over here okay.

69
00:03:40,000 --> 00:03:45,000
Once I import it uh, now it's time that I should be calling my hugging face API.

70
00:03:45,000 --> 00:03:47,000
And let me just do one thing.

71
00:03:47,000 --> 00:03:52,000
Let me also make sure to put this particular condition over here for my API, hf underscore API.

72
00:03:52,000 --> 00:03:59,000
So I'll say if HF underscore API dot strip uh and here I'm using lm so lm now I have to create.

73
00:03:59,000 --> 00:04:00,000
Right.

74
00:04:00,000 --> 00:04:06,000
So I will go over here I have commented out this particular LM and instead of writing like this I will

75
00:04:06,000 --> 00:04:07,000
go to my experiment page.

76
00:04:07,000 --> 00:04:09,000
And you know that how I have called this.

77
00:04:09,000 --> 00:04:10,000
Right.

78
00:04:10,000 --> 00:04:14,000
So I will just copy this entire thing like Mistral seven B and all.

79
00:04:14,000 --> 00:04:15,000
I will paste it over here.

80
00:04:16,000 --> 00:04:17,000
That's it.

81
00:04:17,000 --> 00:04:18,000
That is the change.

82
00:04:19,000 --> 00:04:21,000
So simple right now.

83
00:04:21,000 --> 00:04:24,000
Your task will be that whatever end to end projects we have created, right?

84
00:04:24,000 --> 00:04:30,000
Just try to see whether we are having something or not related to this right now.

85
00:04:30,000 --> 00:04:35,000
Inside this token, you will be able to see that I'm calling OS dot get env right h f underscore token

86
00:04:35,000 --> 00:04:36,000
right.

87
00:04:36,000 --> 00:04:41,000
So this particular token needs to be replaced with whatever token I am going to get.

88
00:04:41,000 --> 00:04:44,000
So this is nothing, but it will be a hf API key, right?

89
00:04:44,000 --> 00:04:46,000
Whatever token I will be getting from my website.

90
00:04:46,000 --> 00:04:47,000
That's it.

91
00:04:47,000 --> 00:04:48,000
Right?

92
00:04:49,000 --> 00:04:50,000
This is so simple.

93
00:04:50,000 --> 00:04:51,000
That's it.

94
00:04:51,000 --> 00:04:51,000
Right.

95
00:04:51,000 --> 00:04:57,000
And here you have actually done that change this entire model where you have calling this particular

96
00:04:57,000 --> 00:04:59,000
LLM model from the API with the help of API itself.

97
00:04:59,000 --> 00:05:02,000
So now let's go ahead and execute this.

98
00:05:02,000 --> 00:05:06,000
I'll say Streamlit run App.py.

99
00:05:06,000 --> 00:05:09,000
And now, finally, you can see that I've executed it.

100
00:05:10,000 --> 00:05:11,000
Now let's do the same thing.

101
00:05:11,000 --> 00:05:12,000
I will take this.

102
00:05:12,000 --> 00:05:12,000
Now.

103
00:05:12,000 --> 00:05:14,000
My LM model is completely changed.

104
00:05:14,000 --> 00:05:17,000
Before that, I'll just go ahead and put my hugging face API token.

105
00:05:17,000 --> 00:05:21,000
It is present over here in my env file.

106
00:05:21,000 --> 00:05:23,000
And here I will go back.

107
00:05:23,000 --> 00:05:24,000
I will paste it over here.

108
00:05:25,000 --> 00:05:29,000
Okay, now let's try the same YouTube URL.

109
00:05:29,000 --> 00:05:33,000
The content will be different when compared to Google Gamma two.

110
00:05:33,000 --> 00:05:35,000
Because Google Gamma two is a much better model.

111
00:05:35,000 --> 00:05:37,000
It is a huge 9 billion parameters, right?

112
00:05:37,000 --> 00:05:40,000
And this is just a smaller model that we have.

113
00:05:40,000 --> 00:05:41,000
But it is also a very good model.

114
00:05:41,000 --> 00:05:45,000
So here you can see in this video Kushner discusses the differences.

115
00:05:45,000 --> 00:05:46,000
It says Kushner okay.

116
00:05:46,000 --> 00:05:50,000
Whenever I say crush it assumes crush okay.

117
00:05:50,000 --> 00:05:53,000
And all the information is there with respect to the summary, the same thing.

118
00:05:53,000 --> 00:05:56,000
What I will do, I will also do it for this particular website.

119
00:05:56,000 --> 00:06:03,000
And here easily you could see that okay, so beautifully we are able to do all these things right now.

120
00:06:03,000 --> 00:06:05,000
I'll go ahead and summarize the content.

121
00:06:07,000 --> 00:06:08,000
Any page.

122
00:06:08,000 --> 00:06:11,000
You should be able to summarize it in a much more easy way.

123
00:06:11,000 --> 00:06:12,000
Right.

124
00:06:12,000 --> 00:06:17,000
So again this model somewhat time it is taking.

125
00:06:17,000 --> 00:06:19,000
But now you can see this entire information.

126
00:06:19,000 --> 00:06:20,000
Right.

127
00:06:20,000 --> 00:06:20,000
right?

128
00:06:20,000 --> 00:06:23,000
So yeah, this was it from my side.

129
00:06:23,000 --> 00:06:25,000
This was with respect to Lang Chen and Huggingface.

130
00:06:25,000 --> 00:06:27,000
I hope you like this particular video.

131
00:06:27,000 --> 00:06:32,000
And now one of the tasks that I really want to give, go ahead and explore other projects and try to

132
00:06:32,000 --> 00:06:36,000
integrate with Huggingface endpoint with using any models that you really want.

133
00:06:36,000 --> 00:06:37,000
Okay.

134
00:06:37,000 --> 00:06:41,000
See what kind of issues you face and then you can probably proceed ahead with that.

135
00:06:41,000 --> 00:06:42,000
So yes, this was it from my side.

136
00:06:42,000 --> 00:06:44,000
I hope you liked this particular video.

137
00:06:44,000 --> 00:06:45,000
I will see you all in the next video.

138
00:06:45,000 --> 00:06:45,000
Thank you.

139
00:06:45,000 --> 00:06:46,000
Take care.

140
00:06:46,000 --> 00:06:46,000
Bye bye.

