Spaces:
Build error
Build error
File size: 1,009 Bytes
d3fbdd8 a181011 35a61ec 4f9177c 35a61ec a181011 35a61ec a181011 35a61ec a181011 4f9177c 35a61ec 2ffa538 d3fbdd8 35a61ec a181011 35a61ec 68fba31 |
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 |
from flask import Flask, render_template, request, send_file, make_response
# Import your attendance model and processing functions
from run import predict_and_show
import pandas as pd
app = Flask("Ogs")
@app.route('/')
def index():
return render_template('index.html')
@app.route('/upload', methods=['POST'])
def upload():
if 'file' not in request.files:
return "No file part"
file = request.files['file']
if file.filename == '':
return "No selected file"
# Process the image using your attendance model
data = predict_and_show(file)
html_content = "<html><body><h1>Attendance Report</h1><ul>"
for item in data:
html_content += f"<li>{item}</li>"
html_content += "</ul></body></html>"
# Create a response object with the generated HTML
response = make_response(html_content)
response.headers['Content-Type'] = 'text/html'
return response
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=7860)
|