Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|