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)

相关推荐
pride.li3 小时前
第12章 Python 教程-流程控制:循环结构
linux·服务器·python·算法
鬼手点金3 小时前
模型即 Agent:当模型本身成为产品
开发语言·前端·人工智能·python·机器学习
田里的水稻3 小时前
PyTorch-Dataset\DataLoader数据加载
人工智能·pytorch·python
卷无止境4 小时前
Python 3.14 自由线程:拆掉 GIL 之后,我们到底得到了什么
后端·python
染指11104 小时前
147.Agent-LangGraph归并函数
开发语言·人工智能·python·langchain·agents
小白学大数据4 小时前
逆向分析短视频平台 a_bogus 参数:从 JavaScript 混淆到 Python 复现
javascript·python·音视频
外收内放4 小时前
数据分析(数据清洗)
python·学习·数据分析
小小张说故事4 小时前
Python 的 True + True 为什么等于 2?bool 是 int 子类,这个设计坑了多少人
python
神仙别闹5 小时前
基于Python实现自动化测试作业—图像增广方案
图像处理·python·计算机视觉
坊钰5 小时前
【LangGraph框架入门级】12. 人机交互:interrupt 中断与 Command 恢复
开发语言·数据库·python·人机交互·ai编程·langgraph