Spaces:
Sleeping
Sleeping
Omar ID EL MOUMEN
commited on
Commit
Β·
2e329bd
1
Parent(s):
a6a5360
Fix frontend
Browse files- app.py +5 -2
- {frontend β static}/script.js +0 -0
- {frontend β static}/style.css +0 -0
- {frontend β templates}/index.html +2 -2
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from fastapi.responses import FileResponse
|
|
|
|
| 4 |
from contextlib import asynccontextmanager
|
| 5 |
import xml.etree.ElementTree as xmlparser
|
| 6 |
import requests
|
|
@@ -8,7 +9,7 @@ from pydantic import BaseModel
|
|
| 8 |
import sys
|
| 9 |
import random
|
| 10 |
import fitz
|
| 11 |
-
import re
|
| 12 |
from io import BytesIO
|
| 13 |
from datetime import datetime
|
| 14 |
|
|
@@ -26,6 +27,8 @@ async def lifespan(app: FastAPI):
|
|
| 26 |
|
| 27 |
app = FastAPI(lifespan=lifespan)
|
| 28 |
|
|
|
|
|
|
|
| 29 |
origins = [
|
| 30 |
"*",
|
| 31 |
]
|
|
@@ -40,7 +43,7 @@ app.add_middleware(
|
|
| 40 |
|
| 41 |
@app.get("/")
|
| 42 |
async def root():
|
| 43 |
-
return FileResponse("
|
| 44 |
|
| 45 |
class Query(BaseModel):
|
| 46 |
keyword: str
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from fastapi.responses import FileResponse
|
| 4 |
+
from fastapi.staticfiles import StaticFiles
|
| 5 |
from contextlib import asynccontextmanager
|
| 6 |
import xml.etree.ElementTree as xmlparser
|
| 7 |
import requests
|
|
|
|
| 9 |
import sys
|
| 10 |
import random
|
| 11 |
import fitz
|
| 12 |
+
import re,os
|
| 13 |
from io import BytesIO
|
| 14 |
from datetime import datetime
|
| 15 |
|
|
|
|
| 27 |
|
| 28 |
app = FastAPI(lifespan=lifespan)
|
| 29 |
|
| 30 |
+
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 31 |
+
|
| 32 |
origins = [
|
| 33 |
"*",
|
| 34 |
]
|
|
|
|
| 43 |
|
| 44 |
@app.get("/")
|
| 45 |
async def root():
|
| 46 |
+
return FileResponse(os.path.join("templates", "index.html"))
|
| 47 |
|
| 48 |
class Query(BaseModel):
|
| 49 |
keyword: str
|
{frontend β static}/script.js
RENAMED
|
File without changes
|
{frontend β static}/style.css
RENAMED
|
File without changes
|
{frontend β templates}/index.html
RENAMED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<title>ArXiv Document Search</title>
|
| 3 |
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
| 4 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css">
|
| 5 |
-
<link rel="stylesheet" href="style.css">
|
| 6 |
</head>
|
| 7 |
<body>
|
| 8 |
<h1>Search ArXiv Documents</h1>
|
|
@@ -22,5 +22,5 @@
|
|
| 22 |
</div>
|
| 23 |
</div>
|
| 24 |
</div>
|
| 25 |
-
<script src="script.js"></script>
|
| 26 |
</body>
|
|
|
|
| 2 |
<title>ArXiv Document Search</title>
|
| 3 |
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
| 4 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css">
|
| 5 |
+
<link rel="stylesheet" href="/static/style.css">
|
| 6 |
</head>
|
| 7 |
<body>
|
| 8 |
<h1>Search ArXiv Documents</h1>
|
|
|
|
| 22 |
</div>
|
| 23 |
</div>
|
| 24 |
</div>
|
| 25 |
+
<script src="/static/script.js"></script>
|
| 26 |
</body>
|