File size: 399 Bytes
869c384
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio as gr
from flask import request

# 创建一个函数,该函数设置 cookie 并返回消息
def set_cookie():
    request.cookies.set("user_cookie", "HelloCookie")
    return "Cookie has been set!"

# 创建 Gradio 接口,指定输入为 None(因为这里不需要输入)
iface = gr.Interface(fn=set_cookie, inputs=None, outputs="text")

# 启动 Gradio 应用
iface.launch()