File size: 4,586 Bytes
c9ebbeb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d7b29fb
ecee04f
c9ebbeb
 
2b136fd
ecee04f
c9ebbeb
 
216ff33
ecee04f
c9ebbeb
 
2b136fd
ecee04f
c9ebbeb
 
2b136fd
ecee04f
c9ebbeb
 
2b136fd
ecee04f
c9ebbeb
 
2b136fd
ecee04f
c9ebbeb
 
 
6604be1
c9ebbeb
d0172fe
91e58dd
6604be1
c9ebbeb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from pydantic import BaseModel
from fastapi.staticfiles import StaticFiles


# Create FastAPI instance
app = FastAPI()

# Request model
class InputData(BaseModel):
    text: str

# Mount the static folder
app.mount("/static", StaticFiles(directory="static"), name="static")

# Home Route with HTML page and description
@app.get("/", response_class=HTMLResponse)
async def home():
    html_content = """
    <html>
    <head>
        <title>Solar AI Model</title>
        <style>
            body {
                font-family: Arial, sans-serif;
                text-align: center;
                margin: 20px;
                background-color: #d4edda; /* Light Green Background */
            }
            h1 {
                color: #2c3e50;
            }
            .image-container {
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                gap: 20px;
                margin-top: 20px;
            }
            .image-box {
                display: flex;
                flex-direction: column;
                align-items: center;
                width: 220px; /* Adjusted for better alignment */
            }
            .image-box img {
                width: 200px;  /* Increased Image Size */
                height: auto;
                border-radius: 10px;
                box-shadow: 3px 3px 12px rgba(0, 0, 0, 0.3);
                transition: transform 0.3s, box-shadow 0.3s;
            }
            .image-box img:hover {
                transform: scale(1.1);
                box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.4);
            }
            .image-name {
                margin-top: 8px;
                font-size: 16px;
                font-weight: bold;
                color: #333;
            }
            .link-container {
                margin-top: 25px;
                font-size: 20px;
            }
            a {
                text-decoration: none;
                color: #007bff;
                font-weight: bold;
            }
            a:hover {
                color: #0056b3;
            }
            .container {
                background: rgba(255, 255, 255, 0.8); /* Light white box effect */
                padding: 20px;
                border-radius: 10px;
                display: inline-block;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <h1>Welcome to the Solar Cell Detection AI Vision Models</h1>

            <!-- Image Grid Container -->
            <div class="image-container">
                <div class="image-box">
                    <img src="/static/results/output_cell0005.png" alt="AI in Solar">
                    <p class="image-name">Cell1</p>
                </div>
                <div class="image-box">
                    <img src="/static/results/output_cell0008.png" alt="AI in Solar">
                    <p class="image-name">Cell2</p>
                </div>
                <div class="image-box">
                    <img src="/static/results/output_cell0014.png" alt="AI in Solar">
                    <p class="image-name">Cell3</p>
                </div>
                <div class="image-box">
                    <img src="/static/results/output_cell0027.png" alt="AI in Solar">
                    <p class="image-name">Cell4</p>
                </div>
                <div class="image-box">
                    <img src="/static/results/output_cell0023.png" alt="AI in Solar">
                    <p class="image-name">Cell5</p>
                </div>
                <div class="image-box">
                    <img src="/static/results/output_cell0048.png" alt="AI in SolarSolar">
                    <p class="image-name">Cell6</p>
                </div>
                <div class="image-box">
                    <img src="/static/results/output_cell0057.png" alt="AI in Solar">
                    <p class="image-name">Cell7</p>
                </div>
            </div>

            <Link Section>
            <div class="link-container">
                <p>This is a Solar EL Cell Anomaly Detection AI Model</p>
                <p><a href="" target="_blank">The Demo Model Soon</a></p>
            </div>
        </div>
    </body>
</html>




    """
    return HTMLResponse(content=html_content)

# Prediction Route
@app.post("/predict")
async def predict(data: InputData):
    # Example: Simple text length prediction
    result = {"prediction": len(data.text)}
    return result