sharafetdinov42 commited on
Commit
ac84244
·
verified ·
1 Parent(s): 4e4df5e

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +8 -13
streamlit_app.py CHANGED
@@ -1,10 +1,11 @@
1
- import os, time, pathlib, shutil
2
 
3
  os.environ.setdefault("TMPDIR", "/tmp/streamlit_tmp")
4
  tmpdir = pathlib.Path(os.environ["TMPDIR"])
5
  tmpdir.mkdir(parents=True, exist_ok=True)
6
 
7
  def prune_old_files(root: str, max_age_sec: int = 30 * 60):
 
8
  now = time.time()
9
  p = pathlib.Path(root)
10
  if not p.exists():
@@ -23,21 +24,15 @@ def prune_old_files(root: str, max_age_sec: int = 30 * 60):
23
  pass
24
 
25
  prune_old_files(tmpdir.as_posix(), max_age_sec=30 * 60)
26
-
27
  prune_old_files("/tmp", max_age_sec=60 * 60)
28
 
29
  import streamlit as st
30
 
31
- main_page = st.Page("main.py", title="Описание"
32
- )
33
- Leaderboard_page = st.Page("Leaderboard.py", title="Лидерборд"
34
- )
 
35
 
36
- pg = st.navigation(
37
- {
38
- "Main": [Leaderboard_page, main_page],
39
- }
40
- )
41
- st.set_page_config(page_title="Leaderboard", layout="wide", page_icon="🏆",
42
- )
43
  pg.run()
 
1
+ import os, time, pathlib
2
 
3
  os.environ.setdefault("TMPDIR", "/tmp/streamlit_tmp")
4
  tmpdir = pathlib.Path(os.environ["TMPDIR"])
5
  tmpdir.mkdir(parents=True, exist_ok=True)
6
 
7
  def prune_old_files(root: str, max_age_sec: int = 30 * 60):
8
+ import time
9
  now = time.time()
10
  p = pathlib.Path(root)
11
  if not p.exists():
 
24
  pass
25
 
26
  prune_old_files(tmpdir.as_posix(), max_age_sec=30 * 60)
 
27
  prune_old_files("/tmp", max_age_sec=60 * 60)
28
 
29
  import streamlit as st
30
 
31
+ # ДОЛЖНО БЫТЬ ПЕРВЫМ st-вызовом:
32
+ st.set_page_config(page_title="Leaderboard", layout="wide", page_icon="🏆")
33
+
34
+ main_page = st.Page("main.py", title="Описание")
35
+ leaderboard_page = st.Page("Leaderboard.py", title="Лидерборд")
36
 
37
+ pg = st.navigation({"Main": [leaderboard_page, main_page]})
 
 
 
 
 
 
38
  pg.run()