dtyago commited on
Commit
7832703
β€’
1 Parent(s): 379f50c

restructure project

Browse files
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
Dockerfile CHANGED
@@ -1,20 +1,32 @@
 
1
  FROM python:3.9
2
 
3
- WORKDIR /code
 
4
 
5
- COPY ./requirements.txt /code/requirements.txt
 
 
 
6
 
7
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
8
 
9
- RUN useradd -m -u 1000 user
 
10
 
 
11
  USER user
12
 
13
- ENV HOME=/home/user \
14
- PATH=/home/user/.local/bin:$PATH
15
-
16
  WORKDIR $HOME/app
17
 
18
- COPY --chown=user . $HOME/app
 
 
 
 
 
19
 
20
- CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ # Use an official Python runtime as a parent image
2
  FROM python:3.9
3
 
4
+ # Create a non-root user with a specified user ID
5
+ RUN useradd -m -u 1000 user
6
 
7
+ # Set environment variables for the non-root user
8
+ ENV HOME=/home/user \
9
+ PATH=/home/user/.local/bin:$PATH \
10
+ NAME=EduConnect
11
 
12
+ # Set the non-root user's home directory as the working directory
13
+ WORKDIR $HOME
14
 
15
+ # Copy the application files into the non-root user's home directory, ensuring the user owns the copied files
16
+ COPY --chown=user:user . ./app
17
 
18
+ # Change to the non-root user
19
  USER user
20
 
21
+ # Set the working directory to where the application files are
 
 
22
  WORKDIR $HOME/app
23
 
24
+ # Install any needed packages specified in requirements.txt
25
+ # As the non-root user, ensure packages are installed to the user's home directory
26
+ RUN pip install --no-cache-dir --user -r requirements.txt
27
+
28
+ # Make port 7860 available to the world outside this container
29
+ EXPOSE 7860
30
 
31
+ # Run the FastAPI application using Uvicorn, binding to port 7860
32
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -9,3 +9,37 @@ license: apache-2.0
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
12
+
13
+ ```
14
+ EduConnect/
15
+ β”œβ”€β”€ app/
16
+ β”‚ β”œβ”€β”€ __init__.py # Initializes the FastAPI app and global configurations
17
+ β”‚ β”œβ”€β”€ main.py # Entry point for the FastAPI application, defining routes
18
+ β”‚ β”œβ”€β”€ dependencies.py # Dependency utilities for JWT token verification, etc.
19
+ β”‚ β”œβ”€β”€ models.py # Database models for ORM
20
+ β”‚ β”œβ”€β”€ schemas.py # Pydantic schemas for request and response validation
21
+ β”‚ β”œβ”€β”€ crud.py # CRUD operations interfacing with the database
22
+ β”‚ β”œβ”€β”€ api/
23
+ β”‚ β”‚ β”œβ”€β”€ __init__.py
24
+ β”‚ β”‚ β”œβ”€β”€ userlogin.py # Endpoint for user login functionality
25
+ β”‚ β”‚ β”œβ”€β”€ userlogout.py # Endpoint for user logout functionality
26
+ β”‚ β”‚ β”œβ”€β”€ userchat.py # Endpoint for chat functionality
27
+ β”‚ β”‚ └── userhistory.py # Endpoint for loading chat history
28
+ β”‚ β”œβ”€β”€ admin/
29
+ β”‚ β”‚ β”œβ”€β”€ __init__.py
30
+ β”‚ β”‚ β”œβ”€β”€ admin_functions.py # Contains server-side logic for admin tasks
31
+ β”‚ β”‚ └── templates/ # Jinja2 templates for admin UI
32
+ β”‚ β”‚ β”œβ”€β”€ admin_login.html # Template for admin login page
33
+ β”‚ β”‚ └── user_registration.html # Template for user registration page
34
+ β”‚ └── utils/
35
+ β”‚ β”œβ”€β”€ __init__.py
36
+ β”‚ β”œβ”€β”€ authentication.py # Integrates MTCNN and Facenet for login authentication
37
+ β”‚ └── database.py # ChromaDB integration and database utilities
38
+ β”œβ”€β”€ static/
39
+ β”‚ β”œβ”€β”€ css/
40
+ β”‚ β”œβ”€β”€ js/
41
+ β”‚ └── images/
42
+ β”œβ”€β”€ Dockerfile # Docker configuration for setting up the environment
43
+ β”œβ”€β”€ requirements.txt # Lists all Python library dependencies
44
+ └── .env # Environment variables for configuration settings
45
+ ```
app/.DS_Store ADDED
Binary file (6.15 kB). View file
 
app/__init__.py ADDED
File without changes
app/admin/.DS_Store ADDED
Binary file (6.15 kB). View file
 
app/admin/__init__.py ADDED
File without changes
app/admin/templates/admin_login.html ADDED
File without changes
app/api/.DS_Store ADDED
Binary file (6.15 kB). View file
 
app/api/__init__.py ADDED
File without changes
app/api/login.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # # app/api/login.py
2
+ # from fastapi import APIRouter, HTTPException, Depends, File, UploadFile
3
+ # from ..utils.authentication import verify_user
4
+ # from ..schemas import LoginSchema
5
+ # from ..crud import get_user_by_email, create_access_token
6
+
7
+ # router = APIRouter()
8
+
9
+ # @router.post("/login/")
10
+ # async def login(user_image: UploadFile = File(...)):
11
+ # # Use MTCNN and Facenet to embed the image and verify user
12
+ # user_verified, user_email = verify_user(user_image.file)
13
+ # if not user_verified:
14
+ # raise HTTPException(status_code=400, detail="Authentication Failed")
15
+
16
+ # # Query ChromaDB for similarity and retrieve user details
17
+ # user = get_user_by_email(user_email)
18
+ # if not user:
19
+ # raise HTTPException(status_code=404, detail="User not found")
20
+
21
+ # # Generate JWT session token
22
+ # access_token = create_access_token(data={"sub": user.email})
23
+ # return {"access_token": access_token, "token_type": "bearer"}
{api β†’ app}/main.py RENAMED
@@ -1,9 +1,8 @@
1
- from fastapi import FastAPI
2
  from fastapi.middleware.cors import CORSMiddleware
3
  from fastapi.staticfiles import StaticFiles
4
  from fastapi.responses import FileResponse
5
 
6
- from transformers import pipeline
7
 
8
  app = FastAPI()
9
 
@@ -17,15 +16,12 @@ app.add_middleware(
17
  allow_headers=["*"],
18
  )
19
 
20
- pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
 
21
 
22
- @app.get("/infer_t5")
23
- def t5(input):
24
- output = pipe_flan(input)
25
- return {"output": output[0]["generated_text"]}
26
-
27
- app.mount("/", StaticFiles(directory="static", html=True), name="static")
28
 
29
  @app.get("/")
30
- def index() -> FileResponse:
31
- return FileResponse(path="/app/static/index.html", media_type="text/html")
 
1
+ from fastapi import FastAPI, Request
2
  from fastapi.middleware.cors import CORSMiddleware
3
  from fastapi.staticfiles import StaticFiles
4
  from fastapi.responses import FileResponse
5
 
 
6
 
7
  app = FastAPI()
8
 
 
16
  allow_headers=["*"],
17
  )
18
 
19
+ # Mount static files
20
+ app.mount("/static", StaticFiles(directory="static"), name="static")
21
 
22
+ # Setup Jinja2Templates to point to the templates directory
23
+ templates = Jinja2Templates(directory="app/admin/templates")
 
 
 
 
24
 
25
  @app.get("/")
26
+ async def get_admin_login(request: Request):
27
+ return templates.TemplateResponse("admin_login.html", {"request": request})
app/utils/__init__.py ADDED
File without changes
requirements.txt CHANGED
@@ -1,6 +1,13 @@
1
- fastapi==0.74.*
2
- requests==2.27.*
3
- sentencepiece==0.1.*
4
- torch==1.11.*
5
- transformers==4.*
6
- uvicorn[standard]==0.17.*
 
 
 
 
 
 
 
 
1
+ fastapi==0.74.* # Core framework for building APIs.
2
+ uvicorn[standard]==0.17.* # ASGI server for FastAPI, supports live reloading.
3
+ requests==2.27.* # For making HTTP requests, if needed by your app.
4
+ torch==1.11.* # PyTorch, for handling deep learning models.
5
+ transformers==4.* # From Hugging Face, for working with pre-trained LLMs.
6
+ sentencepiece==0.1.* # For chat text processing
7
+ mtcnn==0.1.1 # For face detection in images.
8
+ python-jose[cryptography]==3.3.* # For creating, parsing, and verifying JWT tokens.
9
+ python-multipart==0.0.5 # Necessary for form data handling, including file uploads.
10
+ numpy==1.22.* # Fundamental package for scientific computing.
11
+ chromadb==0.4.22 # Vector database interaction libraries.
12
+ keras-facenet==0.3.2 # For face recognition and embedding, used alongside MTCNN.
13
+ jinja2==3.0.* # For Admin site redndering
static/.DS_Store ADDED
Binary file (6.15 kB). View file
 
static/css/mvp.css ADDED
@@ -0,0 +1,536 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* MVP.css v1.14 - https://github.com/andybrewer/mvp */
2
+
3
+ :root {
4
+ --active-brightness: 0.85;
5
+ --border-radius: 5px;
6
+ --box-shadow: 2px 2px 10px;
7
+ --color-accent: #118bee15;
8
+ --color-bg: #fff;
9
+ --color-bg-secondary: #e9e9e9;
10
+ --color-link: #118bee;
11
+ --color-secondary: #920de9;
12
+ --color-secondary-accent: #920de90b;
13
+ --color-shadow: #f4f4f4;
14
+ --color-table: #118bee;
15
+ --color-text: #000;
16
+ --color-text-secondary: #999;
17
+ --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
18
+ --hover-brightness: 1.2;
19
+ --justify-important: center;
20
+ --justify-normal: left;
21
+ --line-height: 1.5;
22
+ --width-card: 285px;
23
+ --width-card-medium: 460px;
24
+ --width-card-wide: 800px;
25
+ --width-content: 1080px;
26
+ }
27
+
28
+ @media (prefers-color-scheme: dark) {
29
+ :root[color-mode="user"] {
30
+ --color-accent: #0097fc4f;
31
+ --color-bg: #333;
32
+ --color-bg-secondary: #555;
33
+ --color-link: #0097fc;
34
+ --color-secondary: #e20de9;
35
+ --color-secondary-accent: #e20de94f;
36
+ --color-shadow: #bbbbbb20;
37
+ --color-table: #0097fc;
38
+ --color-text: #f7f7f7;
39
+ --color-text-secondary: #aaa;
40
+ }
41
+ }
42
+
43
+ html {
44
+ scroll-behavior: smooth;
45
+ }
46
+
47
+ @media (prefers-reduced-motion: reduce) {
48
+ html {
49
+ scroll-behavior: auto;
50
+ }
51
+ }
52
+
53
+ /* Layout */
54
+ article aside {
55
+ background: var(--color-secondary-accent);
56
+ border-left: 4px solid var(--color-secondary);
57
+ padding: 0.01rem 0.8rem;
58
+ }
59
+
60
+ body {
61
+ background: var(--color-bg);
62
+ color: var(--color-text);
63
+ font-family: var(--font-family);
64
+ line-height: var(--line-height);
65
+ margin: 0;
66
+ overflow-x: hidden;
67
+ padding: 0;
68
+ }
69
+
70
+ footer,
71
+ header,
72
+ main {
73
+ margin: 0 auto;
74
+ max-width: var(--width-content);
75
+ padding: 3rem 1rem;
76
+ }
77
+
78
+ hr {
79
+ background-color: var(--color-bg-secondary);
80
+ border: none;
81
+ height: 1px;
82
+ margin: 4rem 0;
83
+ width: 100%;
84
+ }
85
+
86
+ section {
87
+ display: flex;
88
+ flex-wrap: wrap;
89
+ justify-content: var(--justify-important);
90
+ }
91
+
92
+ section img,
93
+ article img {
94
+ max-width: 100%;
95
+ }
96
+
97
+ section pre {
98
+ overflow: auto;
99
+ }
100
+
101
+ section aside {
102
+ border: 1px solid var(--color-bg-secondary);
103
+ border-radius: var(--border-radius);
104
+ box-shadow: var(--box-shadow) var(--color-shadow);
105
+ margin: 1rem;
106
+ padding: 1.25rem;
107
+ width: var(--width-card);
108
+ }
109
+
110
+ section aside:hover {
111
+ box-shadow: var(--box-shadow) var(--color-bg-secondary);
112
+ }
113
+
114
+ [hidden] {
115
+ display: none;
116
+ }
117
+
118
+ /* Headers */
119
+ article header,
120
+ div header,
121
+ main header {
122
+ padding-top: 0;
123
+ }
124
+
125
+ header {
126
+ text-align: var(--justify-important);
127
+ }
128
+
129
+ header a b,
130
+ header a em,
131
+ header a i,
132
+ header a strong {
133
+ margin-left: 0.5rem;
134
+ margin-right: 0.5rem;
135
+ }
136
+
137
+ header nav img {
138
+ margin: 1rem 0;
139
+ }
140
+
141
+ section header {
142
+ padding-top: 0;
143
+ width: 100%;
144
+ }
145
+
146
+ /* Nav */
147
+ nav {
148
+ align-items: center;
149
+ display: flex;
150
+ font-weight: bold;
151
+ justify-content: space-between;
152
+ margin-bottom: 7rem;
153
+ }
154
+
155
+ nav ul {
156
+ list-style: none;
157
+ padding: 0;
158
+ }
159
+
160
+ nav ul li {
161
+ display: inline-block;
162
+ margin: 0 0.5rem;
163
+ position: relative;
164
+ text-align: left;
165
+ }
166
+
167
+ /* Nav Dropdown */
168
+ nav ul li:hover ul {
169
+ display: block;
170
+ }
171
+
172
+ nav ul li ul {
173
+ background: var(--color-bg);
174
+ border: 1px solid var(--color-bg-secondary);
175
+ border-radius: var(--border-radius);
176
+ box-shadow: var(--box-shadow) var(--color-shadow);
177
+ display: none;
178
+ height: auto;
179
+ left: -2px;
180
+ padding: .5rem 1rem;
181
+ position: absolute;
182
+ top: 1.7rem;
183
+ white-space: nowrap;
184
+ width: auto;
185
+ z-index: 1;
186
+ }
187
+
188
+ nav ul li ul::before {
189
+ /* fill gap above to make mousing over them easier */
190
+ content: "";
191
+ position: absolute;
192
+ left: 0;
193
+ right: 0;
194
+ top: -0.5rem;
195
+ height: 0.5rem;
196
+ }
197
+
198
+ nav ul li ul li,
199
+ nav ul li ul li a {
200
+ display: block;
201
+ }
202
+
203
+ /* Typography */
204
+ code,
205
+ samp {
206
+ background-color: var(--color-accent);
207
+ border-radius: var(--border-radius);
208
+ color: var(--color-text);
209
+ display: inline-block;
210
+ margin: 0 0.1rem;
211
+ padding: 0 0.5rem;
212
+ }
213
+
214
+ details {
215
+ margin: 1.3rem 0;
216
+ }
217
+
218
+ details summary {
219
+ font-weight: bold;
220
+ cursor: pointer;
221
+ }
222
+
223
+ h1,
224
+ h2,
225
+ h3,
226
+ h4,
227
+ h5,
228
+ h6 {
229
+ line-height: var(--line-height);
230
+ text-wrap: balance;
231
+ }
232
+
233
+ mark {
234
+ padding: 0.1rem;
235
+ }
236
+
237
+ ol li,
238
+ ul li {
239
+ padding: 0.2rem 0;
240
+ }
241
+
242
+ p {
243
+ margin: 0.75rem 0;
244
+ padding: 0;
245
+ width: 100%;
246
+ }
247
+
248
+ pre {
249
+ margin: 1rem 0;
250
+ max-width: var(--width-card-wide);
251
+ padding: 1rem 0;
252
+ }
253
+
254
+ pre code,
255
+ pre samp {
256
+ display: block;
257
+ max-width: var(--width-card-wide);
258
+ padding: 0.5rem 2rem;
259
+ white-space: pre-wrap;
260
+ }
261
+
262
+ small {
263
+ color: var(--color-text-secondary);
264
+ }
265
+
266
+ sup {
267
+ background-color: var(--color-secondary);
268
+ border-radius: var(--border-radius);
269
+ color: var(--color-bg);
270
+ font-size: xx-small;
271
+ font-weight: bold;
272
+ margin: 0.2rem;
273
+ padding: 0.2rem 0.3rem;
274
+ position: relative;
275
+ top: -2px;
276
+ }
277
+
278
+ /* Links */
279
+ a {
280
+ color: var(--color-link);
281
+ display: inline-block;
282
+ font-weight: bold;
283
+ text-decoration: underline;
284
+ }
285
+
286
+ a:active {
287
+ filter: brightness(var(--active-brightness));
288
+ }
289
+
290
+ a:hover {
291
+ filter: brightness(var(--hover-brightness));
292
+ }
293
+
294
+ a b,
295
+ a em,
296
+ a i,
297
+ a strong,
298
+ button,
299
+ input[type="submit"] {
300
+ border-radius: var(--border-radius);
301
+ display: inline-block;
302
+ font-size: medium;
303
+ font-weight: bold;
304
+ line-height: var(--line-height);
305
+ margin: 0.5rem 0;
306
+ padding: 1rem 2rem;
307
+ }
308
+
309
+ button,
310
+ input[type="submit"] {
311
+ font-family: var(--font-family);
312
+ }
313
+
314
+ button:active,
315
+ input[type="submit"]:active {
316
+ filter: brightness(var(--active-brightness));
317
+ }
318
+
319
+ button:hover,
320
+ input[type="submit"]:hover {
321
+ cursor: pointer;
322
+ filter: brightness(var(--hover-brightness));
323
+ }
324
+
325
+ a b,
326
+ a strong,
327
+ button,
328
+ input[type="submit"] {
329
+ background-color: var(--color-link);
330
+ border: 2px solid var(--color-link);
331
+ color: var(--color-bg);
332
+ }
333
+
334
+ a em,
335
+ a i {
336
+ border: 2px solid var(--color-link);
337
+ border-radius: var(--border-radius);
338
+ color: var(--color-link);
339
+ display: inline-block;
340
+ padding: 1rem 2rem;
341
+ }
342
+
343
+ article aside a {
344
+ color: var(--color-secondary);
345
+ }
346
+
347
+ /* Images */
348
+ figure {
349
+ margin: 0;
350
+ padding: 0;
351
+ }
352
+
353
+ figure img {
354
+ max-width: 100%;
355
+ }
356
+
357
+ figure figcaption {
358
+ color: var(--color-text-secondary);
359
+ }
360
+
361
+ /* Forms */
362
+ button:disabled,
363
+ input:disabled {
364
+ background: var(--color-bg-secondary);
365
+ border-color: var(--color-bg-secondary);
366
+ color: var(--color-text-secondary);
367
+ cursor: not-allowed;
368
+ }
369
+
370
+ button[disabled]:hover,
371
+ input[type="submit"][disabled]:hover {
372
+ filter: none;
373
+ }
374
+
375
+ form {
376
+ border: 1px solid var(--color-bg-secondary);
377
+ border-radius: var(--border-radius);
378
+ box-shadow: var(--box-shadow) var(--color-shadow);
379
+ display: block;
380
+ max-width: var(--width-card-wide);
381
+ min-width: var(--width-card);
382
+ padding: 1.5rem;
383
+ text-align: var(--justify-normal);
384
+ }
385
+
386
+ form header {
387
+ margin: 1.5rem 0;
388
+ padding: 1.5rem 0;
389
+ }
390
+
391
+ input,
392
+ label,
393
+ select,
394
+ textarea {
395
+ display: block;
396
+ font-size: inherit;
397
+ max-width: var(--width-card-wide);
398
+ }
399
+
400
+ input[type="checkbox"],
401
+ input[type="radio"] {
402
+ display: inline-block;
403
+ }
404
+
405
+ input[type="checkbox"]+label,
406
+ input[type="radio"]+label {
407
+ display: inline-block;
408
+ font-weight: normal;
409
+ position: relative;
410
+ top: 1px;
411
+ }
412
+
413
+ input[type="range"] {
414
+ padding: 0.4rem 0;
415
+ }
416
+
417
+ input,
418
+ select,
419
+ textarea {
420
+ border: 1px solid var(--color-bg-secondary);
421
+ border-radius: var(--border-radius);
422
+ margin-bottom: 1rem;
423
+ padding: 0.4rem 0.8rem;
424
+ }
425
+
426
+ input[type="text"],
427
+ textarea {
428
+ width: calc(100% - 1.6rem);
429
+ }
430
+
431
+ input[readonly],
432
+ textarea[readonly] {
433
+ background-color: var(--color-bg-secondary);
434
+ }
435
+
436
+ label {
437
+ font-weight: bold;
438
+ margin-bottom: 0.2rem;
439
+ }
440
+
441
+ /* Popups */
442
+ dialog {
443
+ border: 1px solid var(--color-bg-secondary);
444
+ border-radius: var(--border-radius);
445
+ box-shadow: var(--box-shadow) var(--color-shadow);
446
+ position: fixed;
447
+ top: 50%;
448
+ left: 50%;
449
+ transform: translate(-50%, -50%);
450
+ width: 50%;
451
+ z-index: 999;
452
+ }
453
+
454
+ /* Tables */
455
+ table {
456
+ border: 1px solid var(--color-bg-secondary);
457
+ border-radius: var(--border-radius);
458
+ border-spacing: 0;
459
+ display: inline-block;
460
+ max-width: 100%;
461
+ overflow-x: auto;
462
+ padding: 0;
463
+ white-space: nowrap;
464
+ }
465
+
466
+ table td,
467
+ table th,
468
+ table tr {
469
+ padding: 0.4rem 0.8rem;
470
+ text-align: var(--justify-important);
471
+ }
472
+
473
+ table thead {
474
+ background-color: var(--color-table);
475
+ border-collapse: collapse;
476
+ border-radius: var(--border-radius);
477
+ color: var(--color-bg);
478
+ margin: 0;
479
+ padding: 0;
480
+ }
481
+
482
+ table thead tr:first-child th:first-child {
483
+ border-top-left-radius: var(--border-radius);
484
+ }
485
+
486
+ table thead tr:first-child th:last-child {
487
+ border-top-right-radius: var(--border-radius);
488
+ }
489
+
490
+ table thead th:first-child,
491
+ table tr td:first-child {
492
+ text-align: var(--justify-normal);
493
+ }
494
+
495
+ table tr:nth-child(even) {
496
+ background-color: var(--color-accent);
497
+ }
498
+
499
+ /* Quotes */
500
+ blockquote {
501
+ display: block;
502
+ font-size: x-large;
503
+ line-height: var(--line-height);
504
+ margin: 1rem auto;
505
+ max-width: var(--width-card-medium);
506
+ padding: 1.5rem 1rem;
507
+ text-align: var(--justify-important);
508
+ }
509
+
510
+ blockquote footer {
511
+ color: var(--color-text-secondary);
512
+ display: block;
513
+ font-size: small;
514
+ line-height: var(--line-height);
515
+ padding: 1.5rem 0;
516
+ }
517
+
518
+ /* Scrollbars */
519
+ * {
520
+ scrollbar-width: thin;
521
+ scrollbar-color: rgb(202, 202, 232) auto;
522
+ }
523
+
524
+ *::-webkit-scrollbar {
525
+ width: 5px;
526
+ height: 5px;
527
+ }
528
+
529
+ *::-webkit-scrollbar-track {
530
+ background: transparent;
531
+ }
532
+
533
+ *::-webkit-scrollbar-thumb {
534
+ background-color: rgb(202, 202, 232);
535
+ border-radius: 10px;
536
+ }
static/index.html DELETED
@@ -1,24 +0,0 @@
1
- <main>
2
- <section id="text-gen">
3
- <h2>Text generation using Flan T5</h2>
4
- <p>
5
- Model:
6
- <a
7
- href="https://huggingface.co/google/flan-t5-small"
8
- rel="noreferrer"
9
- target="_blank"
10
- >google/flan-t5-small
11
- </a>
12
- </p>
13
- <form class="text-gen-form">
14
- <label for="text-gen-input">Text prompt</label>
15
- <input
16
- id="text-gen-input"
17
- type="text"
18
- value="German: There are many ducks"
19
- />
20
- <button id="text-gen-submit">Submit</button>
21
- <p class="text-gen-output"></p>
22
- </form>
23
- </section>
24
- </main>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/{script.js β†’ js/script.js} RENAMED
File without changes
static/style.css DELETED
@@ -1,45 +0,0 @@
1
- body {
2
- --text: hsl(0 0% 15%);
3
- padding: 2.5rem;
4
- font-family: sans-serif;
5
- color: var(--text);
6
- }
7
-
8
- body.dark-theme {
9
- --text: hsl(0 0% 90%);
10
- background-color: hsl(223 39% 7%);
11
- }
12
-
13
- main {
14
- max-width: 80rem;
15
- text-align: center;
16
- }
17
-
18
- section {
19
- display: flex;
20
- flex-direction: column;
21
- align-items: center;
22
- }
23
-
24
- a {
25
- color: var(--text);
26
- }
27
-
28
- form {
29
- width: 30rem;
30
- margin: 0 auto;
31
- }
32
-
33
- input {
34
- width: 100%;
35
- }
36
-
37
- button {
38
- cursor: pointer;
39
- }
40
-
41
- .text-gen-output {
42
- min-height: 1.2rem;
43
- margin: 1rem;
44
- border: 0.5px solid grey;
45
- }