From the course: Advanced Python Projects: Build AI Applications
Deploy and run the chatbot - Python Tutorial
From the course: Advanced Python Projects: Build AI Applications
Deploy and run the chatbot
- [Instructor] Now is the fun part. Let's run the AI application that we just built. Go to your terminal and type cde Begin. Begin is the folder where this program is located, and then click on the run button. Wait for the code to run. It's completed running. Now go to the ports tab, and this is where our application is located in the port 8000. So over here you'll see a globe symbol, or you can click directly on this link. Click on this link or this globe symbol. It'll take you to the URL. So at the very end of this URL type /docs and type enter. This should take us to our FastAPI interface. The first step is for you to click and expand on the upload file. Once you're here, click try it out. After you click try it out, you should now be able to choose a file to upload. Click on the choose file and navigate to the folder where the file that you want to upload is located. For now, I'm going to be uploading an employee manual for a fictitious company called Landon Hotel, which we created for the purpose of this demonstration. Let's click open. After that, click execute. Once you've executed it, you'll see here at the very bottom that we'll have an S3 file path. This is where our file is stored in the S3 bucket. Copy this link or the file path. Now go up top over to the /chat. Click on this to expand it. And now again, click try it out. Over here, you'll see that when you click try it out, you have these three parameters that pop up. We're going to clear out of the session ID because we don't have any other session ID that exists. This is our first chat. So next what we're going to do is we're going to paste the data source that we copied over from the bottom, which is our S3 bucket storage link. Next, we're going to ask a question about this document. So now let's ask a simple question such as, what is this document about? Let's execute to see what happens. If you scroll down to the response body, you see that there's an answer that's produced. So the AI application now turned us an answer that says, "This document is an employee manual for Landon Hotels. It provides information about working conditions, benefits, policies affecting employment at the hotel. It also includes sections on changes in policy, employment application, communication, definition of employee status." So you get the idea, right? So we're able to upload a document and ask questions about it. So you get the idea. We're able to upload a document and ask any question about the document, and the AI program will return back an answer related to that. So let's try one more question. "If I go to the Landon Hotel corporate office at 6:00 PM on a Thursday, will it be open?" So we have no idea about what time the Landon Hotel Corporation is open until, so let's see whether this program will be able to give us an answer. Click execute. Let's see what happens. Yeah, it produced a response stating that, "No, the Landon Hotel corporate offices are open for business from 8:00 AM to 6:00 PM Monday through Friday. If you go to the office on 6:00 PM it will be closed." Which is correct. That's it. Now this concludes the demonstration of our backend application. Congratulations on creating the backend.
Contents
-
-
-
-
-
Setting up MongoDB4m 24s
-
Generate chat responses using GPT-3.5 and Langchain2m 46s
-
Load conversation history for a given session ID1m 16s
-
Create new sessions and add chat history to existing sessions1m 11s
-
Setup FastAPI app, CORS, S3 session, and obtain a chat response3m 43s
-
Upload files to Amazon S3 storage bucket2m 39s
-
Deploy and run the chatbot4m 2s
-
Challenge: Complete the backend code for file upload2m 13s
-
Solution: Complete the backend code for file upload9m 52s
-
-
-