PadmasaliGovardhan
commited on
Commit
·
f1e8605
1
Parent(s):
6ca6e19
final update commit
Browse files- app/main.py +45 -2
app/main.py
CHANGED
|
@@ -43,11 +43,54 @@ def extract_text_from_pdf(pdf_path):
|
|
| 43 |
|
| 44 |
|
| 45 |
@app.get("/", response_class=HTMLResponse)
|
| 46 |
-
def
|
| 47 |
return """
|
| 48 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
"""
|
| 50 |
|
|
|
|
| 51 |
@app.post("/upload_pdf/")
|
| 52 |
async def upload_pdf(file: UploadFile = File(...)):
|
| 53 |
filename = os.path.basename(file.filename)
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
@app.get("/", response_class=HTMLResponse)
|
| 46 |
+
def home():
|
| 47 |
return """
|
| 48 |
+
<html>
|
| 49 |
+
<head>
|
| 50 |
+
<title>AI NoteBook Assistant (RAG)</title>
|
| 51 |
+
<style>
|
| 52 |
+
body {
|
| 53 |
+
background-color: #0f0f0f;
|
| 54 |
+
color: #e0e0e0;
|
| 55 |
+
font-family: 'Inter', sans-serif;
|
| 56 |
+
display: flex;
|
| 57 |
+
flex-direction: column;
|
| 58 |
+
align-items: center;
|
| 59 |
+
justify-content: center;
|
| 60 |
+
height: 100vh;
|
| 61 |
+
margin: 0;
|
| 62 |
+
}
|
| 63 |
+
h1 {
|
| 64 |
+
color: #facc15;
|
| 65 |
+
margin-bottom: 10px;
|
| 66 |
+
}
|
| 67 |
+
a {
|
| 68 |
+
color: #22d3ee;
|
| 69 |
+
text-decoration: none;
|
| 70 |
+
font-weight: bold;
|
| 71 |
+
background: rgba(255,255,255,0.1);
|
| 72 |
+
padding: 10px 20px;
|
| 73 |
+
border-radius: 10px;
|
| 74 |
+
transition: all 0.3s ease;
|
| 75 |
+
}
|
| 76 |
+
a:hover {
|
| 77 |
+
background: #22d3ee;
|
| 78 |
+
color: #000;
|
| 79 |
+
}
|
| 80 |
+
</style>
|
| 81 |
+
</head>
|
| 82 |
+
<body>
|
| 83 |
+
<h1>🚀 AI NoteBook Assistant Backend is Running!</h1>
|
| 84 |
+
<p>Access the frontend from here:</p>
|
| 85 |
+
<a href="https://ai-notebook-rag.netlify.app" target="_blank">
|
| 86 |
+
Open AI Notes Assistant App
|
| 87 |
+
</a>
|
| 88 |
+
<p style="margin-top:20px; opacity:0.7;">Made by Govardhan 💛</p>
|
| 89 |
+
</body>
|
| 90 |
+
</html>
|
| 91 |
"""
|
| 92 |
|
| 93 |
+
|
| 94 |
@app.post("/upload_pdf/")
|
| 95 |
async def upload_pdf(file: UploadFile = File(...)):
|
| 96 |
filename = os.path.basename(file.filename)
|