BuckLakeAI / app.py
parkerjj's picture
Change to Gradio
13ee506
raw
history blame
525 Bytes
import gradio as gr
from pydantic import BaseModel
# 定义 Gradio 接口
def gradio_interface(text):
# 在这里实现实际的预处理逻辑
result = text + " (preprocessed)"
return {"result": result}
# 配置 Gradio 接口
iface = gr.Interface(
fn=gradio_interface,
inputs="text",
outputs="json",
title="文本预处理 API",
description="发送文本到 Gradio 接口进行预处理并获取 JSON 格式的响应"
)
# 运行 Gradio 应用
if __name__ == "__main__":
iface.launch()