...

/

Build the Web Layout to Finish the App

Build the Web Layout to Finish the App

Finish the document question-answering bot implementation by adding an HTML web page to make the app more accessible.

Create an HTML page for our app

Let’s add an HTML page where we’ll have a search box to provide a question and a button to hit the /ask-question API. We’ll also render the output on the same HTML page so that we don’t lose our output. We will also add a button (which is by default hidden until we get the answer back from the API) that will copy the answer to our clipboard. Let’s take a look at the HTML and CSS for a simple design of our HTML page.

HTML web page for our document question-answering app

Code explanation:

Let’s briefly discuss the HTML and CSS code.

  • The HTML code consists of a heading and the title of our project. Then we add an input tag to accept the question from the user. We add one button that call the /ask-question API. Then, we add a text area that will be used to render the response from the API and a hidden button to copy the response to clipboard (by manipulating DOM elements).

  • The CSS code ...