ogegadavis254's picture
Update app.py
53cb2b6 verified
raw
history blame
1.72 kB
from flask import Flask, redirect, render_template_string
import time
app = Flask(__name__)
# HTML template for the message page
message_template = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redirecting...</title>
<style>
body {{
font-family: Arial, sans-serif;
text-align: center;
margin-top: 100px;
}}
.message {{
font-size: 24px;
margin-bottom: 20px;
}}
.redirect-info {{
font-size: 18px;
color: #666;
}}
.link {{
color: blue;
text-decoration: underline;
cursor: pointer;
}}
</style>
</head>
<body>
<div class="message">{{ message }}</div>
<div class="redirect-info">{{ redirect_info }}</div>
<div class="link"><a href="{{ redirect_url }}" target="_blank">Click here</a> if not redirected.</div>
</body>
</html>
"""
@app.route('/')
def redirect_to_website():
time.sleep(3) # Delay in seconds before redirecting
message = "Redirecting you to our new AI experience! If not please click the link"
redirect_info = "You will be redirected shortly."
redirect_url = "https://ogegadavis254-roasting-2-0.hf.space"
# Render the HTML template with the message, redirect_info, and redirect_url
return render_template_string(message_template, message=message, redirect_info=redirect_info, redirect_url=redirect_url)
@app.route('/redirect')
def perform_redirect():
return redirect('https://ogegadavis254-roasting-2-0.hf.space')
if __name__ == '__main__':
app.run(debug=True)