Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- app.py +9 -1
- logo.jpg +0 -0
- templates/index.html +30 -1
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import uuid
|
|
| 4 |
import asyncio
|
| 5 |
import datetime
|
| 6 |
from fastapi import FastAPI, HTTPException, Depends, Query, Body
|
| 7 |
-
from fastapi.responses import HTMLResponse
|
| 8 |
from fastapi.middleware.cors import CORSMiddleware
|
| 9 |
from contextlib import asynccontextmanager
|
| 10 |
|
|
@@ -98,6 +98,14 @@ app.add_middleware(
|
|
| 98 |
allow_headers=["*"],
|
| 99 |
)
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
# Serves the main UI
|
| 102 |
@app.get("/", response_class=HTMLResponse)
|
| 103 |
async def read_index():
|
|
|
|
| 4 |
import asyncio
|
| 5 |
import datetime
|
| 6 |
from fastapi import FastAPI, HTTPException, Depends, Query, Body
|
| 7 |
+
from fastapi.responses import HTMLResponse, FileResponse
|
| 8 |
from fastapi.middleware.cors import CORSMiddleware
|
| 9 |
from contextlib import asynccontextmanager
|
| 10 |
|
|
|
|
| 98 |
allow_headers=["*"],
|
| 99 |
)
|
| 100 |
|
| 101 |
+
# API: Serve the logo image
|
| 102 |
+
@app.get("/logo.jpg")
|
| 103 |
+
async def get_logo():
|
| 104 |
+
logo_path = "logo.jpg"
|
| 105 |
+
if not os.path.exists(logo_path):
|
| 106 |
+
raise HTTPException(status_code=404, detail="Logo file not found.")
|
| 107 |
+
return FileResponse(logo_path)
|
| 108 |
+
|
| 109 |
# Serves the main UI
|
| 110 |
@app.get("/", response_class=HTMLResponse)
|
| 111 |
async def read_index():
|
logo.jpg
ADDED
|
templates/index.html
CHANGED
|
@@ -103,7 +103,33 @@
|
|
| 103 |
/* Header Styling */
|
| 104 |
header {
|
| 105 |
text-align: center;
|
| 106 |
-
margin-bottom:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
}
|
| 108 |
|
| 109 |
header h1 {
|
|
@@ -610,6 +636,9 @@
|
|
| 610 |
|
| 611 |
<!-- Header -->
|
| 612 |
<header>
|
|
|
|
|
|
|
|
|
|
| 613 |
<h1 id="main-title">SmartIoT Dashboard</h1>
|
| 614 |
<p>ระบบควบคุมระบบไฟฟ้าและตั้งเวลาอัจฉริยะ (ESP32-WROOM-32D)</p>
|
| 615 |
</header>
|
|
|
|
| 103 |
/* Header Styling */
|
| 104 |
header {
|
| 105 |
text-align: center;
|
| 106 |
+
margin-bottom: 1.5rem;
|
| 107 |
+
display: flex;
|
| 108 |
+
flex-direction: column;
|
| 109 |
+
align-items: center;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
.brand-logo-container {
|
| 113 |
+
margin-bottom: 0.8rem;
|
| 114 |
+
display: inline-flex;
|
| 115 |
+
justify-content: center;
|
| 116 |
+
align-items: center;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.brand-logo {
|
| 120 |
+
width: 84px;
|
| 121 |
+
height: 84px;
|
| 122 |
+
border-radius: 50%;
|
| 123 |
+
border: 2px solid rgba(255, 255, 255, 0.08);
|
| 124 |
+
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(139, 92, 246, 0.15);
|
| 125 |
+
object-fit: cover;
|
| 126 |
+
transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.brand-logo:hover {
|
| 130 |
+
transform: scale(1.06) rotate(6deg);
|
| 131 |
+
border-color: var(--color-cyan);
|
| 132 |
+
box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 25px rgba(6, 182, 212, 0.35);
|
| 133 |
}
|
| 134 |
|
| 135 |
header h1 {
|
|
|
|
| 636 |
|
| 637 |
<!-- Header -->
|
| 638 |
<header>
|
| 639 |
+
<div class="brand-logo-container">
|
| 640 |
+
<img src="/logo.jpg" alt="Logo" class="brand-logo">
|
| 641 |
+
</div>
|
| 642 |
<h1 id="main-title">SmartIoT Dashboard</h1>
|
| 643 |
<p>ระบบควบคุมระบบไฟฟ้าและตั้งเวลาอัจฉริยะ (ESP32-WROOM-32D)</p>
|
| 644 |
</header>
|