Spaces:
Sleeping
Sleeping
File size: 1,774 Bytes
ce7bf5b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import streamlit as st"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def main():\n",
" st.title(\"科研代码分析应用\")\n",
" uploaded_file = st.file_uploader(\"\", type=[\"py\"])\n",
"\n",
" if uploaded_file is not None:\n",
" # 读取代码文件内容\n",
" code_content = uploaded_file.read()\n",
"\n",
" # 在这里添加你的代码分析功能,例如解析、可视化等\n",
"\n",
" # 显示代码内容\n",
" st.code(code_content, language=\"python\")\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-02-19 09:17:25.437 \n",
" \u001b[33m\u001b[1mWarning:\u001b[0m to view this Streamlit app on a browser, run it with the following\n",
" command:\n",
"\n",
" streamlit run /data/home/wudezhi/anaconda3/envs/mlfold/lib/python3.8/site-packages/ipykernel_launcher.py [ARGUMENTS]\n"
]
}
],
"source": [
"if __name__ == \"__main__\":\n",
" main()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "mlfold",
"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.8.18"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|