Skip to content

Instantly share code, notes, and snippets.

@Vesnica
Last active March 7, 2023 08:41
Show Gist options
  • Save Vesnica/f58406bdca5d86d56bded48d672f70d0 to your computer and use it in GitHub Desktop.
Save Vesnica/f58406bdca5d86d56bded48d672f70d0 to your computer and use it in GitHub Desktop.
Streamlit
"""
# My first app
Here's our first attempt at using data to create a table:
"""
import streamlit as st
message = """
一些常见的微分公式如下(其中$f$和$g$是可微函数,$k$是常数):
1. 导数定义式:$\displaystyle f'(x) = \lim_{h\to0}\frac{f(x+h)-f(x)}{h}$
2. 幂规则:$(x^k)' = kx^{k-1}$
3. 和差规则:$(f+g)' = f'+g'$,$(f-g)'=f'-g'$
4. 积规则:$(fg)' = f'g + fg'$
5. 商规则:$\left(\frac{f}{g}\right)' = \frac{f'g - fg'}{g^2}$
6. 链式法则:$\displaystyle (f(g(x)))' = f'(g(x))g'(x)$
一个使用Golang语言编写的HelloWorld程序如下:
```go
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
```
运行结果为:
```
Hello, world!
```
"""
def str_to_raw(s):
raw_map = {8:r'\b', 7:r'\a', 12:r'\f', 13:r'\r', 9:r'\t', 11:r'\v'}
return r''.join(i if ord(i) > 32 else raw_map.get(ord(i), i) for i in s)
a = "$\left(\frac{f}{g}\right)' = \frac{f'g - fg'}{g^2}$"
b = r"$\left(\frac{f}{g}\right)' = \frac{f'g - fg'}{g^2}$"
st.write(b)
st.write(str_to_raw(a))
st.write(str_to_raw(message))
  • export STREAMLIT_BROWSER_GATHER_USAGE_STATS=0,禁用数据收集
  • export STREAMLIT_CLIENT_CACHING=0,禁用客户端数据缓存
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment