记10,Gradio介绍

Gradio

Hugging Face:开源模型管理托管中心

https://www.gradio.app

官方文档:https://www.gradio.app/guides/quickstart

有图形化剂界面。也可以快速部署和分享:添加一个参数"share=True",就会产生一个公共的URL(72h后过期)

python 复制代码
import gradio as gr

def reverse_text(text):
     return text[::1]

# 接入的函数接口, 输入和输出(都是文本类型)
demo = gr.Interface(fun=reverse_text, input="text", output="text")

# 如果有2个返回类型,一个是文本一个是数字output=["text", "number"]。还可以添加标题,简短的描述,以及例子
# def reverse_text(text):
#      return text[::1], len(text)
# gr.Interface(fun=reverse_text, input="text", output=["text", "number"], title="这是标题", description="这是描述",example="[["123"], ["456"]])

# 启动应用
demo.launch(share="True")
相关推荐
极梦网络无忧12 小时前
OpenClaw 基础使用说明(中文版)
python
codeJinger12 小时前
【Python】操作Excel文件
python·excel
XLYcmy13 小时前
一个针对医疗RAG系统的数据窃取攻击工具
python·网络安全·ai·llm·agent·rag·ai安全
Islucas13 小时前
Claude code入门保姆级教程
python·bash·claude
萝卜白菜。13 小时前
TongWeb7.0相同的类指明加载顺序
开发语言·python·pycharm
赵钰老师13 小时前
【ADCIRC】基于“python+”潮汐、风驱动循环、风暴潮等海洋水动力模拟实践技术应用
python·信息可视化·数据分析
爬山算法14 小时前
MongoDB(80)如何在MongoDB中使用多文档事务?
数据库·python·mongodb
YuanDaima204814 小时前
基于 LangChain 1.0 的检索增强生成(RAG)实战
人工智能·笔记·python·langchain·个人开发·langgraph
RopenYuan15 小时前
FastAPI -API Router的应用
前端·网络·python