Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,35 @@ from tokenizers import Tokenizer, AddedToken
|
|
9 |
import streamlit as st
|
10 |
from st_click_detector import click_detector
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
DEVICE = "cpu"
|
13 |
MODEL_OPTIONS = ["msmarco-distilbert-base-tas-b", "all-mpnet-base-v2"]
|
14 |
DESCRIPTION = """
|
|
|
9 |
import streamlit as st
|
10 |
from st_click_detector import click_detector
|
11 |
|
12 |
+
# This lil dealio is my test of the new experiemntal primitives which promise to put cach in streamlit within striking distance of simulating cognitive episodic memory (personalized feelings about a moment through space time), and semantic memory (factual memories we are ready to share and communicate like your email address or physical address yo
|
13 |
+
|
14 |
+
# What impresses me about these two beautiful new prims is that one called the singleton can share memory across sessions (think all users yo)
|
15 |
+
|
16 |
+
@st.singleton
|
17 |
+
def get_sessionmaker(search_param):
|
18 |
+
# This is for illustration purposes only
|
19 |
+
url = "https://en.wikipedia.org/wiki/"
|
20 |
+
#engine = create_engine(DB_URL)
|
21 |
+
#return sessionmaker(engine)
|
22 |
+
return url
|
23 |
+
|
24 |
+
search_param = "Star_Trek:_Discovery"
|
25 |
+
sm= get_sessionmaker(search_param)
|
26 |
+
print(sm)
|
27 |
+
|
28 |
+
# What is supercool about the second prim the memo is it makes unwieldy data very wieldy. Like the Lord of Rings in reverse re "you cannot wield it! none of us can." -> "You can wield it, now everyone can."
|
29 |
+
|
30 |
+
@st.experimental_memo
|
31 |
+
def factorial(n):
|
32 |
+
if n < 1:
|
33 |
+
return 1
|
34 |
+
return n * factorial(n - 1)
|
35 |
+
|
36 |
+
em10 = factorial(10)
|
37 |
+
print("em10:",em10))
|
38 |
+
em09 = factorial(9) # Returns instantly!
|
39 |
+
print("em09:",em09))
|
40 |
+
|
41 |
DEVICE = "cpu"
|
42 |
MODEL_OPTIONS = ["msmarco-distilbert-base-tas-b", "all-mpnet-base-v2"]
|
43 |
DESCRIPTION = """
|