ogegadavis254 commited on
Commit
53cb2b6
1 Parent(s): e88ff01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -14
app.py CHANGED
@@ -1,20 +1,57 @@
1
- import gradio as gr
2
  import time
3
- import webbrowser
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  def redirect_to_website():
6
- # Open the website in the default browser after a short delay
7
  time.sleep(3) # Delay in seconds before redirecting
8
- webbrowser.open_new_tab('https://ogegadavis254-roasting-2-0.hf.space')
9
- return "Redirecting you to our new website..."
 
 
 
10
 
11
- iface = gr.Interface(
12
- fn=redirect_to_website,
13
- title="Redirecting to Our New AI Experience",
14
- description="You will be redirected to our new website shortly.",
15
- theme="huggingface",
16
- allow_flagging=False,
17
- allow_screenshot=False
18
- )
19
 
20
- iface.launch()
 
 
1
+ from flask import Flask, redirect, render_template_string
2
  import time
 
3
 
4
+ app = Flask(__name__)
5
+
6
+ # HTML template for the message page
7
+ message_template = """
8
+ <!DOCTYPE html>
9
+ <html lang="en">
10
+ <head>
11
+ <meta charset="UTF-8">
12
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
13
+ <title>Redirecting...</title>
14
+ <style>
15
+ body {{
16
+ font-family: Arial, sans-serif;
17
+ text-align: center;
18
+ margin-top: 100px;
19
+ }}
20
+ .message {{
21
+ font-size: 24px;
22
+ margin-bottom: 20px;
23
+ }}
24
+ .redirect-info {{
25
+ font-size: 18px;
26
+ color: #666;
27
+ }}
28
+ .link {{
29
+ color: blue;
30
+ text-decoration: underline;
31
+ cursor: pointer;
32
+ }}
33
+ </style>
34
+ </head>
35
+ <body>
36
+ <div class="message">{{ message }}</div>
37
+ <div class="redirect-info">{{ redirect_info }}</div>
38
+ <div class="link"><a href="{{ redirect_url }}" target="_blank">Click here</a> if not redirected.</div>
39
+ </body>
40
+ </html>
41
+ """
42
+
43
+ @app.route('/')
44
  def redirect_to_website():
 
45
  time.sleep(3) # Delay in seconds before redirecting
46
+ message = "Redirecting you to our new AI experience! If not please click the link"
47
+ redirect_info = "You will be redirected shortly."
48
+ redirect_url = "https://ogegadavis254-roasting-2-0.hf.space"
49
+ # Render the HTML template with the message, redirect_info, and redirect_url
50
+ return render_template_string(message_template, message=message, redirect_info=redirect_info, redirect_url=redirect_url)
51
 
52
+ @app.route('/redirect')
53
+ def perform_redirect():
54
+ return redirect('https://ogegadavis254-roasting-2-0.hf.space')
 
 
 
 
 
55
 
56
+ if __name__ == '__main__':
57
+ app.run(debug=True)