Spaces:
Configuration error
Configuration error
getad72493
commited on
Upload 5 files
Browse files- README.md +0 -11
- config.py +7 -0
- requirements.txt +2 -1
- templates/index.html +33 -0
- templates/upload.html +21 -0
README.md
CHANGED
@@ -1,11 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Faflask
|
3 |
-
emoji: 🏃
|
4 |
-
colorFrom: green
|
5 |
-
colorTo: indigo
|
6 |
-
sdk: docker
|
7 |
-
pinned: false
|
8 |
-
short_description: flask test
|
9 |
-
---
|
10 |
-
|
11 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
class Config:
|
4 |
+
UPLOAD_FOLDER = 'uploads/'
|
5 |
+
STATIC_FOLDER = 'static/images'
|
6 |
+
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16 MB
|
7 |
+
ALLOWED_EXTENSIONS = {'jpg', 'jpeg', 'png', 'gif'}
|
requirements.txt
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
|
|
|
|
1 |
+
Flask==2.3.3
|
2 |
+
Werkzeug==2.3.3
|
templates/index.html
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Image Gallery</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<h1>Gallery</h1>
|
10 |
+
|
11 |
+
<div class="gallery">
|
12 |
+
{% for image in images %}
|
13 |
+
<div class="image">
|
14 |
+
<img src="{{ url_for('static', filename='images/' + image) }}" alt="{{ image }}" width="200">
|
15 |
+
</div>
|
16 |
+
{% endfor %}
|
17 |
+
</div>
|
18 |
+
|
19 |
+
<div class="pagination">
|
20 |
+
{% if page > 1 %}
|
21 |
+
<a href="{{ url_for('index', page=page-1) }}">Previous</a>
|
22 |
+
{% endif %}
|
23 |
+
<span>Page {{ page }} of {{ total_pages }}</span>
|
24 |
+
{% if page < total_pages %}
|
25 |
+
<a href="{{ url_for('index', page=page+1) }}">Next</a>
|
26 |
+
{% endif %}
|
27 |
+
</div>
|
28 |
+
|
29 |
+
<footer>
|
30 |
+
<a href="{{ url_for('upload') }}">Upload Images</a>
|
31 |
+
</footer>
|
32 |
+
</body>
|
33 |
+
</html>
|
templates/upload.html
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Upload Images</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<h1>Upload Images</h1>
|
10 |
+
|
11 |
+
<form action="{{ url_for('upload') }}" method="POST" enctype="multipart/form-data">
|
12 |
+
<label for="file">Choose Image(s):</label>
|
13 |
+
<input type="file" name="file" multiple><br><br>
|
14 |
+
<button type="submit">Upload</button>
|
15 |
+
</form>
|
16 |
+
|
17 |
+
<footer>
|
18 |
+
<a href="{{ url_for('index') }}">Back to Gallery</a>
|
19 |
+
</footer>
|
20 |
+
</body>
|
21 |
+
</html>
|