Spaces:
Runtime error
Runtime error
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import matplotlib.pyplot as plt
|
4 |
+
import pandas as pd
|
5 |
+
st.markdown("# Streamlit示例")
|
6 |
+
st.markdown("""
|
7 |
+
- 这是
|
8 |
+
- 一个
|
9 |
+
- 无序列表
|
10 |
+
""")
|
11 |
+
|
12 |
+
# 展示pandas数据框
|
13 |
+
st.dataframe(pd.DataFrame([[1, 2], [3, 4]], columns=["a", "b"]))
|
14 |
+
|
15 |
+
# 展示matplotlib绘图
|
16 |
+
arr = np.random.normal(1, 1, size=100)
|
17 |
+
plt.hist(arr, bins=20)
|
18 |
+
plt.title("matplotlib plot")
|
19 |
+
st.pyplot()
|
20 |
+
|
21 |
+
# 加入交互控件,如输入框
|
22 |
+
number = st.number_input("Insert a number", 123)
|
23 |
+
st.write("输入的数字是:", number)
|