Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
c2ed1cd
1
Parent(s):
7ff616c
Update app.py
Browse files
app.py
CHANGED
@@ -116,57 +116,13 @@ def upload_file():
|
|
116 |
def get_image():
|
117 |
return send_from_directory(UPLOAD_FOLDER, IMAGE_FILENAME)
|
118 |
|
119 |
-
@app.route('/se_mes_im2')
|
120 |
-
def index():
|
121 |
-
html = '''
|
122 |
-
<!DOCTYPE html>
|
123 |
-
<html lang="en">
|
124 |
-
<head>
|
125 |
-
<meta charset="UTF-8">
|
126 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
127 |
-
<title>Camera Image</title>
|
128 |
-
</head>
|
129 |
-
<body>
|
130 |
-
<h1>Upload Image</h1>
|
131 |
-
<form id="uploadForm" enctype="multipart/form-data" method="post" action="/upload">
|
132 |
-
<input type="file" name="photo">
|
133 |
-
<button type="submit">Upload</button>
|
134 |
-
</form>
|
135 |
-
<div id="message"></div>
|
136 |
-
<h1>Latest Image</h1>
|
137 |
-
<img id="cameraImage" src="/image" alt="Image" style="width:100%;">
|
138 |
-
<script>
|
139 |
-
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
140 |
-
event.preventDefault();
|
141 |
-
var formData = new FormData(this);
|
142 |
-
fetch('/upload', {
|
143 |
-
method: 'POST',
|
144 |
-
body: formData
|
145 |
-
})
|
146 |
-
.then(response => {
|
147 |
-
if (response.ok) {
|
148 |
-
return response.text();
|
149 |
-
}
|
150 |
-
throw new Error('Network response was not ok.');
|
151 |
-
})
|
152 |
-
.then(data => {
|
153 |
-
document.getElementById('message').innerText = data;
|
154 |
-
var image = document.getElementById("cameraImage");
|
155 |
-
image.src = "/image?" + new Date().getTime();
|
156 |
-
})
|
157 |
-
.catch(error => {
|
158 |
-
document.getElementById('message').innerText = 'Error: ' + error.message;
|
159 |
-
});
|
160 |
-
});
|
161 |
-
</script>
|
162 |
-
</body>
|
163 |
-
</html>
|
164 |
-
'''
|
165 |
-
return render_template_string(html)
|
166 |
|
167 |
|
168 |
|
169 |
|
|
|
|
|
|
|
170 |
|
171 |
|
172 |
|
|
|
116 |
def get_image():
|
117 |
return send_from_directory(UPLOAD_FOLDER, IMAGE_FILENAME)
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
+
@app.route('/se_mes_im2', methods=['GET'])
|
124 |
+
def se_mes_im2():
|
125 |
+
return render_template('se_mes_im2.html')
|
126 |
|
127 |
|
128 |
|