Spaces:
Runtime error
Runtime error
stephenleo
commited on
Commit
•
43def6f
1
Parent(s):
7e53eea
updating to streamlit 1.9
Browse files- helpers.py +37 -37
- requirements.txt +9 -11
helpers.py
CHANGED
@@ -11,7 +11,7 @@ import networkx as nx
|
|
11 |
import textwrap
|
12 |
import logging
|
13 |
|
14 |
-
from streamlit.
|
15 |
from threading import current_thread
|
16 |
from contextlib import contextmanager
|
17 |
from io import StringIO
|
@@ -232,39 +232,39 @@ def network_centrality(topic_data, centrality, centrality_option):
|
|
232 |
# Progress bar printer
|
233 |
# https://github.com/BugzTheBunny/streamlit_logging_output_example/blob/main/app.py
|
234 |
# https://discuss.streamlit.io/t/cannot-print-the-terminal-output-in-streamlit/6602/34
|
235 |
-
@contextmanager
|
236 |
-
def st_redirect(src, dst):
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
@contextmanager
|
260 |
-
def st_stdout(dst):
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
@contextmanager
|
267 |
-
def st_stderr(dst):
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
11 |
import textwrap
|
12 |
import logging
|
13 |
|
14 |
+
# from streamlit.ReportThread import REPORT_CONTEXT_ATTR_NAME
|
15 |
from threading import current_thread
|
16 |
from contextlib import contextmanager
|
17 |
from io import StringIO
|
|
|
232 |
# Progress bar printer
|
233 |
# https://github.com/BugzTheBunny/streamlit_logging_output_example/blob/main/app.py
|
234 |
# https://discuss.streamlit.io/t/cannot-print-the-terminal-output-in-streamlit/6602/34
|
235 |
+
# @contextmanager
|
236 |
+
# def st_redirect(src, dst):
|
237 |
+
# placeholder = st.empty()
|
238 |
+
# output_func = getattr(placeholder, dst)
|
239 |
+
|
240 |
+
# with StringIO() as buffer:
|
241 |
+
# old_write = src.write
|
242 |
+
|
243 |
+
# def new_write(b):
|
244 |
+
# if getattr(current_thread(), REPORT_CONTEXT_ATTR_NAME, None):
|
245 |
+
# buffer.write(b)
|
246 |
+
# time.sleep(1)
|
247 |
+
# buffer.seek(0) # returns pointer to 0 position
|
248 |
+
# output_func(b)
|
249 |
+
# else:
|
250 |
+
# old_write(b)
|
251 |
+
|
252 |
+
# try:
|
253 |
+
# src.write = new_write
|
254 |
+
# yield
|
255 |
+
# finally:
|
256 |
+
# src.write = old_write
|
257 |
+
|
258 |
+
|
259 |
+
# @contextmanager
|
260 |
+
# def st_stdout(dst):
|
261 |
+
# "this will show the prints"
|
262 |
+
# with st_redirect(sys.stdout, dst):
|
263 |
+
# yield
|
264 |
+
|
265 |
+
|
266 |
+
# @contextmanager
|
267 |
+
# def st_stderr(dst):
|
268 |
+
# "This will show the logging"
|
269 |
+
# with st_redirect(sys.stderr, dst):
|
270 |
+
# yield
|
requirements.txt
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
-
bertopic==0.
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
sentence_transformers==2.1.0
|
11 |
-
streamlit==1.3.1
|
|
|
1 |
+
bertopic==0.10.0
|
2 |
+
networkx==2.8.2
|
3 |
+
numpy==1.22.4
|
4 |
+
pandas==1.4.2
|
5 |
+
plotly==5.8.0
|
6 |
+
pyvis==0.2.1
|
7 |
+
scikit_learn==1.1.1
|
8 |
+
sentence_transformers==2.2.0
|
9 |
+
streamlit==1.9.2
|
|
|
|