import streamlit as st from streamlit_option_menu import option_menu menu = { "对话-GPU版ChatGLM-6B by@sdshq": { "link": "https://sdshq-chatglm2-6b-demo.hf.space/", "desc": "", "author": "sdshq" }, "对话-GPU版ChatGPT-web by@lijiacai": { "link": "https://lijiacai-chatgpt-next-web.hf.space/", "desc": "模型ChatGLM-6B,接口兼容openai API,可实现流式在线对话" }, "绘图-图像反推关键词 by@lijiacai": { "link": "https://lijiacai-wd14-tagging-online.hf.space/", "desc": "" }, "绘图-Stable Diffusion 2.1 by@lijiacai": { "link": "https://lijiacai-stable-diffusion-2-1-demo.hf.space/", "desc": "" }, "绘图-Stable Diffusion WebUI CPU by@lijiacai": { "link": "https://lijiacai-stable-diffusion-webui-cpu.hf.space", "desc": "" }, "绘图-Stable Diffusion 2.1 by@stabilityai": { "link": "https://stabilityai-stable-diffusion.hf.space", "desc": "", "author": "stabilityai" }, "工具-翻译 by@lijiacai": { "link": "https://lijiacai-translate.hf.space", "desc": "", }, "工具-视频下载工具 by@未知": { "link": "https://zh.savefrom.net/226/", "desc": "", "shadow-iframe": True }, # "Openai代理接口文档 by@lijiacai": # { # "link": "https://lijiacai-openai-agent.hf.space/docs", # "desc": "" # }, } # 1. as sidebar menu with st.sidebar: selected = option_menu("工具栏", options=list(menu.keys()), icons=None, menu_icon="cast", default_index=1) nav_link = menu.get(selected).get("link") author = menu.get(selected).get("author", "lijiacai") st.markdown( f'[点我前往大屏操作]({nav_link}) 作者by@{author}', ) st.markdown( '', unsafe_allow_html=True ) if not menu.get(selected).get("shadow-iframe"): # 在一个具有自定义样式的div中嵌入IFrame st.markdown(f'
', unsafe_allow_html=True)