Skip to content

Commit

Permalink
create landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
frefrik committed Sep 30, 2024
1 parent 934aad2 commit cc35d66
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from fastapi import FastAPI, Request
from fastapi.middleware.trustedhost import TrustedHostMiddleware
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from starlette.middleware.cors import CORSMiddleware

from app.api.main import api_router
Expand Down Expand Up @@ -65,4 +67,13 @@ async def log_request_and_add_timing(request: Request, call_next):
)


@app.get("/", response_class=HTMLResponse, include_in_schema=False)
async def read_items():
with open("app/static/index.html") as f:
html_content = f.read()

return HTMLResponse(content=html_content, status_code=200)


app.mount("/static", StaticFiles(directory="app/static", html=True), name="static")
app.include_router(api_router, prefix=settings.API_V1_STR)
23 changes: 23 additions & 0 deletions app/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="theme-color" content="#F0F0F0">
<title>ollamadb.dev</title>

<link rel="stylesheet" href="static/style.css" type="text/css" />
</head>

<body>
<main>
<a href="docs/">
<img id="ollama-logo" src="static/ollama-models-api.png" href="api/" alt="Ollama Models API docs" title="Ollama Models API" />
</a>
</main>
<div class="footer">
<p>ollamadb.dev is not affiliated with Ollama</p>
</div>
</body>

</html>
Binary file added app/static/ollama-models-api.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions app/static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: #F0F0F0;
}
main {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
box-sizing: border-box;
}
#ollama-logo {
flex: none;
width: 100%;
max-width: 640px;
height: auto;
}
.footer {
font-size: 12px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
position: fixed;
left: 0;
bottom: 0;
width: 100%;
color: grey;
text-align: center;
}

0 comments on commit cc35d66

Please sign in to comment.