syn / web_app.py
theaniketgiri's picture
� Initial commit to Hugging Face Space
32519eb
raw
history blame contribute delete
998 Bytes
from flask import Flask, render_template, redirect, url_for, flash
import subprocess
import os
app = Flask(__name__)
app.secret_key = 'your_secret_key' # Required for flashing messages
@app.route('/')
def index():
return render_template('index.html')
@app.route('/collect_data')
def collect_data():
try:
subprocess.run(['python', 'setup_data.py'], check=True)
flash('Data collection completed successfully!', 'success')
except subprocess.CalledProcessError as e:
flash(f'Error during data collection: {str(e)}', 'error')
return redirect(url_for('index'))
@app.route('/analyze_data')
def analyze_data():
try:
subprocess.run(['python', 'analyze_data_quality.py'], check=True)
flash('Data analysis completed successfully!', 'success')
except subprocess.CalledProcessError as e:
flash(f'Error during data analysis: {str(e)}', 'error')
return redirect(url_for('index'))
if __name__ == '__main__':
app.run(debug=True)