Gradio学习(一)—————启动一个demo页面

安装(Python 3.7以上版本)

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gradio

新建一个demo文件

import gradio as gr

def greet(name):

return "hello "+name+"!"

demo=gr.Interface(fn=greet,inputs="text",output="text")

因为在虚拟机中启动,而不是pycharm 所以指定主机ip (1.1.1.1)和端口号,如果是在pycharm 中,无需指定

demo.launch(server_name="1.1.1.1",server_port=7860,share=True,inbrowser=True)

相关推荐
yunhuibin1 小时前
GoogLeNet学习
人工智能·python·深度学习·神经网络·学习
易辰君2 小时前
【Python爬虫实战】正则:中文匹配与贪婪非贪婪模式详解
开发语言·爬虫·python
秀儿还能再秀2 小时前
正则表达式核心语法 + Python的 re 库中常用方法
python·正则表达式
xcLeigh2 小时前
Python入门:Python3 正则表达式全面学习教程
python·学习·正则表达式·教程·python3
多恩Stone3 小时前
【C++ debug】在 VS Code 中无 Attach 调试 Python 调用的 C++ 扩展
开发语言·c++·python
XW01059993 小时前
4-11判断素数
前端·python·算法·素数
深蓝电商API3 小时前
爬虫增量更新:基于时间戳与哈希去重
爬虫·python
两万五千个小时3 小时前
构建mini Claude Code:06 - Agent 如何「战略性遗忘」(上下文压缩)
人工智能·python
两万五千个小时3 小时前
构建mini Claude Code:12 - 从「文件冲突」到「分身协作」:Worktree 如何让多 Agent 安全并行
人工智能·python·架构
yuki_uix3 小时前
为什么我的 Auth Token 藏在了 Network 面板的 Doc 里?
前端·python·debug