dongsiqie commited on
Commit
cbf9276
·
verified ·
1 Parent(s): 52b622d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -17
app.py CHANGED
@@ -1,20 +1,10 @@
1
- import gradio as gr
2
- import webbrowser
3
 
4
- # 开启服务时自动打开浏览器到重定向的URL
5
- webbrowser.open('https://dongsiqie.me')
6
 
7
- def redirect():
8
- # 函数内内容可能不会被执行,因为页面会立即重定向
9
- return "如果没有自动重定向,请点击这个 [链接](https://dongsiqie.me)"
10
 
11
- # 创建Gradio接口但不定义输入输出,因为它们不会被用到
12
- iface = gr.Interface(
13
- fn=redirect,
14
- inputs=[],
15
- outputs=[],
16
- title="自动重定向",
17
- description="打开这个服务将会自动重定向到 https://dongsiqie.me"
18
- )
19
-
20
- iface.launch()
 
1
+ from flask import Flask, redirect
 
2
 
3
+ app = Flask(__name__)
 
4
 
5
+ @app.route('/')
6
+ def index():
7
+ return redirect('https://dongsiqie.me', code=302)
8
 
9
+ if __name__ == '__main__':
10
+ app.run()