From 4254dccaeb86568d33edc4d3ba80ebb5a36ca89c Mon Sep 17 00:00:00 2001 From: xinetzone Date: Mon, 8 Apr 2024 17:59:42 +0800 Subject: [PATCH] +doc/ui/others --- doc/linux/bash/faqs.md | 2 +- doc/ui/index.md | 2 + doc/ui/others/flet/index.md | 3 + doc/ui/others/gradio/index.md | 5 + doc/ui/others/gradio/intro.ipynb | 99 +++++++++++++++++++ doc/ui/others/index.md | 8 ++ doc/ui/others/pywebio/index.md | 3 + .../deploy/authentication-without-sso.md | 5 + doc/ui/others/streamlit/deploy/index.md | 16 +++ doc/ui/others/streamlit/index.md | 10 ++ 10 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 doc/ui/others/flet/index.md create mode 100644 doc/ui/others/gradio/index.md create mode 100644 doc/ui/others/gradio/intro.ipynb create mode 100644 doc/ui/others/index.md create mode 100644 doc/ui/others/pywebio/index.md create mode 100644 doc/ui/others/streamlit/deploy/authentication-without-sso.md create mode 100644 doc/ui/others/streamlit/deploy/index.md create mode 100644 doc/ui/others/streamlit/index.md diff --git a/doc/linux/bash/faqs.md b/doc/linux/bash/faqs.md index 129eab7..129a73f 100644 --- a/doc/linux/bash/faqs.md +++ b/doc/linux/bash/faqs.md @@ -87,7 +87,7 @@ wait 等待直到子进程运行完毕 shell 脚本各种执行方式(`source ./*.sh`, `. ./*.sh`, `./*.sh`)的区别 - 结论一: `./*.sh` 的执行方式等价于 `sh ./*.sh` 或者 `bash ./*.sh`,此三种执行脚本的方式都是重新启动一个子 shell,在子 shell 中执行此脚本,脚本中设置的变量在脚本执行完毕后不会保存。但是若 `script.sh` 脚本不是以 `#!/bin/bash` 开头,那么也不会在子进程中执行。 -- 结论二: source ./*.sh和 . ./*.sh的执行方式是等价的,即两种执行方式都是在当前shell进程中执行此脚本,而不是重新启动一个shell 在子shell进程中执行此脚本,并且脚本中设置的变量在脚本执行完毕后会保存下来。 +- 结论二: `source ./*.sh` 和 `. ./*.sh` 的执行方式是等价的,即两种执行方式都是在当前 shell 进程中执行此脚本,而不是重新启动一个 shell 在子 shell 进程中执行此脚本,并且脚本中设置的变量在脚本执行完毕后会保存下来。 ``` 验证依据:没有被 `export` 导出的变量(即非环境变量)是不能被子 shell 继承的 diff --git a/doc/ui/index.md b/doc/ui/index.md index 8aa9c1d..99da40d 100644 --- a/doc/ui/index.md +++ b/doc/ui/index.md @@ -2,4 +2,6 @@ ```{toctree} fastapi/index +nicegui +others/index ``` diff --git a/doc/ui/others/flet/index.md b/doc/ui/others/flet/index.md new file mode 100644 index 0000000..07d5735 --- /dev/null +++ b/doc/ui/others/flet/index.md @@ -0,0 +1,3 @@ +# `flet` + +参考:[flet](https://flet.dev/docs/) diff --git a/doc/ui/others/gradio/index.md b/doc/ui/others/gradio/index.md new file mode 100644 index 0000000..df1bf42 --- /dev/null +++ b/doc/ui/others/gradio/index.md @@ -0,0 +1,5 @@ +# Gradio + +```{toctree} +intro +``` \ No newline at end of file diff --git a/doc/ui/others/gradio/intro.ipynb b/doc/ui/others/gradio/intro.ipynb new file mode 100644 index 0000000..23b5dfa --- /dev/null +++ b/doc/ui/others/gradio/intro.ipynb @@ -0,0 +1,99 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Gradio 简介" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Running on local URL: http://0.0.0.0:4099\n", + "\n", + "To create a public link, set `share=True` in `launch()`.\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import gradio as gr\n", + "import plotly.express as px\n", + "import pandas as pd\n", + "def plotly_plot():\n", + " # prepare some data\n", + " x = [\"Math\", \"Business\", \"Statistics\", \"IT\", \"Commerce\"]\n", + " y = [68, 73, 82, 74, 85]\n", + " data = pd.DataFrame()\n", + " data['Subject'] = x\n", + " data['Score'] = y\n", + " # create a new plot\n", + " p = px.bar(data, x='Subject', y='Score')\n", + "\n", + " return p\n", + "\n", + "# show the results\n", + "outputs = gr.Plot()\n", + "\n", + "demo = gr.Interface(fn=plotly_plot, inputs=None, outputs=outputs)\n", + "\n", + "# demo.launch()\n", + "demo.launch(server_name=\"0.0.0.0\", server_port=4099, share=False, inbrowser=False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "py311", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.7" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/doc/ui/others/index.md b/doc/ui/others/index.md new file mode 100644 index 0000000..8e6f97f --- /dev/null +++ b/doc/ui/others/index.md @@ -0,0 +1,8 @@ +# 其他 + +```{toctree} +pywebio/index +flet/index +gradio/index +streamlit/index +``` diff --git a/doc/ui/others/pywebio/index.md b/doc/ui/others/pywebio/index.md new file mode 100644 index 0000000..38678f0 --- /dev/null +++ b/doc/ui/others/pywebio/index.md @@ -0,0 +1,3 @@ +# PyWebIO + +参考:[PyWebIO](https://pywebio.readthedocs.io/zh-cn/latest/index.html) diff --git a/doc/ui/others/streamlit/deploy/authentication-without-sso.md b/doc/ui/others/streamlit/deploy/authentication-without-sso.md new file mode 100644 index 0000000..2150922 --- /dev/null +++ b/doc/ui/others/streamlit/deploy/authentication-without-sso.md @@ -0,0 +1,5 @@ +# 无 SSO 认证 + +参考:- [无 SSO 认证](https://docs.streamlit.io/knowledge-base/deploy/authentication-without-sso) + +本指南展示了两种简单的技术,使用密钥管理将基本身份验证添加到 Streamlit 应用程序中。 diff --git a/doc/ui/others/streamlit/deploy/index.md b/doc/ui/others/streamlit/deploy/index.md new file mode 100644 index 0000000..1d4ca52 --- /dev/null +++ b/doc/ui/others/streamlit/deploy/index.md @@ -0,0 +1,16 @@ +# Streamlit 部署 + +已经部署 [streamlit-demo](https://github.com/xinetzone/streamlit-demo) 到 [https://xinetzone.streamlit.app](https://xinetzone.streamlit.app)。 + +如果想要嵌入到 iframe,只需要在网站后添加 `/?embed=true`。 + +[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://xinetzone.streamlit.app) + +[streamlit-jupyter](https://github.com/ddobrinskiy/streamlit-jupyter) 使 streamlit 可以在 Jupyter Notebook 中运行。 + + +```{toctree} +:glob: + +* +``` \ No newline at end of file diff --git a/doc/ui/others/streamlit/index.md b/doc/ui/others/streamlit/index.md new file mode 100644 index 0000000..5a6359a --- /dev/null +++ b/doc/ui/others/streamlit/index.md @@ -0,0 +1,10 @@ +# streamlit + +- 集成 plotly:[plotly_chart](https://docs.streamlit.io/library/api-reference/charts/st.plotly_chart) +- [plotly.streamlit.app](https://plotly.streamlit.app/) + + +```{toctree} +deploy/index +ai-stream +``` \ No newline at end of file