samyak152002 commited on
Commit
33fa0fb
1 Parent(s): 8cb6f07

Update app/main.py

Browse files
Files changed (1) hide show
  1. app/main.py +4 -9
app/main.py CHANGED
@@ -1,7 +1,5 @@
1
- # app/main.py
2
- from fastapi import FastAPI, File, UploadFile, HTTPException, Request, Form
3
- from fastapi.responses import JSONResponse, StreamingResponse, HTMLResponse, RedirectResponse
4
- from fastapi.staticfiles import StaticFiles
5
  from fastapi.templating import Jinja2Templates
6
  from typing import Dict, Any
7
  import io
@@ -19,19 +17,16 @@ app = FastAPI(
19
  version="1.0.0"
20
  )
21
 
22
- # Mount static files if any (optional)
23
- # app.mount("/static", StaticFiles(directory="app/static"), name="static")
24
-
25
  # Set up templates
26
  templates = Jinja2Templates(directory="app/templates")
27
 
28
  @app.get("/", response_class=HTMLResponse, summary="Root Endpoint")
29
  def read_root(request: Request):
30
  """
31
- Render the main page with upload form.
32
  """
33
  logger.info("Root endpoint accessed.")
34
- return templates.TemplateResponse("index.html", {"request": request})
35
 
36
  @app.post("/analyze", response_class=HTMLResponse, summary="Analyze PDF for Language Issues")
37
  async def analyze_pdf_endpoint(request: Request, file: UploadFile = File(...)):
 
1
+ from fastapi import FastAPI, File, UploadFile, HTTPException, Request
2
+ from fastapi.responses import JSONResponse, HTMLResponse
 
 
3
  from fastapi.templating import Jinja2Templates
4
  from typing import Dict, Any
5
  import io
 
17
  version="1.0.0"
18
  )
19
 
 
 
 
20
  # Set up templates
21
  templates = Jinja2Templates(directory="app/templates")
22
 
23
  @app.get("/", response_class=HTMLResponse, summary="Root Endpoint")
24
  def read_root(request: Request):
25
  """
26
+ Render a simple HTML to verify the API is running.
27
  """
28
  logger.info("Root endpoint accessed.")
29
+ return HTMLResponse(content="<h1>PDF Language Issue Analyzer API is running.</h1>")
30
 
31
  @app.post("/analyze", response_class=HTMLResponse, summary="Analyze PDF for Language Issues")
32
  async def analyze_pdf_endpoint(request: Request, file: UploadFile = File(...)):