0% found this document useful (0 votes)
4 views2 pages

Main3 Py

This document is a FastAPI application that serves an HTML page with an autocomplete feature using jQuery. The page allows users to enter text and receive suggestions from a predefined list of food items. The application can be run using Uvicorn as the ASGI server.

Uploaded by

adityapandji1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Main3 Py

This document is a FastAPI application that serves an HTML page with an autocomplete feature using jQuery. The page allows users to enter text and receive suggestions from a predefined list of food items. The application can be run using Uvicorn as the ASGI server.

Uploaded by

adityapandji1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

from fastapi import FastAPI, WebSocket

from fastapi.responses import HTMLResponse


import uvicorn

app = FastAPI()

html = """
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Autocomplete using Jquery</title>
<link rel="stylesheet"
href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.
css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
var tags = ['DABELI', 'VADAPAU', 'PANEER', 'ROTI', 'BUTTERMILK',
'PAPAD'];
$( "#tags" ).autocomplete({
source: tags

});
} );
</script>
</head>
<body>

<div class="ui-widget">
<H3>Enter an alphabet to get suggestion:</H3>
<input id="tags">
</div>

</body>
</html>

"""

@app.get("/")
async def get():
return HTMLResponse(html)
if __name__ == "__main__":
uvicorn.run("main3:app")

You might also like