Update app.py
Browse files
app.py
CHANGED
@@ -1,41 +1,80 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
#import torch
|
6 |
-
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM #AutoModelForTokenClassification
|
7 |
-
from sentence_transformers import SentenceTransformer, util
|
8 |
#import lmdeploy
|
9 |
#import turbomind as tm
|
10 |
|
11 |
-
from backend.utils import get_current_ram_usage, ga
|
12 |
#import backend.aragpt
|
13 |
-
import backend.home
|
14 |
-
import backend.processor
|
15 |
#import backend.sa
|
16 |
#import backend.qa
|
17 |
|
18 |
-
st.set_page_config(
|
19 |
-
page_title="TEST", page_icon="π", initial_sidebar_state="expanded", layout="wide"
|
20 |
-
)
|
21 |
|
22 |
-
ga(st.__file__)
|
23 |
|
24 |
-
PAGES = {
|
25 |
-
"Home": backend.home,
|
26 |
-
"Demo": Demo,
|
27 |
-
"About": backend.home
|
28 |
-
}
|
29 |
|
30 |
-
st.sidebar.title("SBSmapper")
|
31 |
-
selection = st.sidebar.radio("Pages", list(PAGES.keys()))
|
32 |
|
33 |
-
page = PAGES[selection]
|
34 |
# with st.spinner(f"Loading {selection} ..."):
|
35 |
#ast.shared.components.write_page(page)
|
36 |
|
37 |
-
st.sidebar.header("Info")
|
38 |
-
st.sidebar.write("Project by JA RAD")
|
39 |
#st.sidebar.write(
|
40 |
# "Pre-trained models are available on [HF Hub](https://huggingface.co/)"
|
41 |
#)
|
@@ -45,9 +84,9 @@ st.sidebar.write("Project by JA RAD")
|
|
45 |
#st.sidebar.write(
|
46 |
# "App source code available on [GitHub](https://github.com/)"
|
47 |
#)
|
48 |
-
if st.sidebar.checkbox("Show RAM usage"):
|
49 |
-
ram = get_current_ram_usage()
|
50 |
-
st.sidebar.write("Ram usage: {:.2f}/{:.2f} GB".format(ram[0], ram[1]))
|
51 |
|
52 |
"""
|
53 |
import os
|
|
|
1 |
import streamlit as st
|
2 |
+
|
3 |
+
# --- SHARED ON ALL PAGES ---
|
4 |
+
#st.logo(image=":material/medical_information:")
|
5 |
+
st.logo("images/medical_information_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.png")
|
6 |
+
st.sidebar.text("Project by JA-RAD")
|
7 |
+
|
8 |
+
|
9 |
+
# --- PAGE SETUP ---
|
10 |
+
home_page = st.Page(
|
11 |
+
page="pages/home.py",
|
12 |
+
title="Home",
|
13 |
+
icon=":material/home:",
|
14 |
+
default=True,)
|
15 |
+
|
16 |
+
demo_page = st.Page(
|
17 |
+
page="pages/demo.py",
|
18 |
+
title="type text",
|
19 |
+
icon=":material/keyboard:",
|
20 |
+
default=False,)
|
21 |
+
|
22 |
+
upload_file_page = st.Page(
|
23 |
+
page="pages/upload_file.py",
|
24 |
+
title="upload file (page not yet active)",
|
25 |
+
icon=":material/file_upload:",
|
26 |
+
default=False,)
|
27 |
+
|
28 |
+
about_page = st.Page(
|
29 |
+
page="pages/about.py",
|
30 |
+
title="About the app",
|
31 |
+
icon=":material/info:",
|
32 |
+
default=False)
|
33 |
+
|
34 |
+
|
35 |
+
# --- NAVIGATION SETUP ---
|
36 |
+
#pg = st.navigation(pages=[home_page, type_text_page, upload_file_page, about_page]) # WITHOUT SECTIONS
|
37 |
+
pg = st.navigation({"Home": [home_page], "Demo": [type_text_page, upload_file_page], "About": [about_page]}) # WITH SECTIONS
|
38 |
+
|
39 |
+
pg.run()
|
40 |
+
|
41 |
+
#import pandas as pd
|
42 |
+
#from io import StringIO
|
43 |
+
#import json
|
44 |
#import torch
|
45 |
+
#from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM #AutoModelForTokenClassification
|
46 |
+
#from sentence_transformers import SentenceTransformer, util
|
47 |
#import lmdeploy
|
48 |
#import turbomind as tm
|
49 |
|
50 |
+
#from backend.utils import get_current_ram_usage, ga
|
51 |
#import backend.aragpt
|
52 |
+
#import backend.home
|
53 |
+
#import backend.processor
|
54 |
#import backend.sa
|
55 |
#import backend.qa
|
56 |
|
57 |
+
#st.set_page_config(
|
58 |
+
# page_title="TEST", page_icon="π", initial_sidebar_state="expanded", layout="wide"
|
59 |
+
#)
|
60 |
|
61 |
+
#ga(st.__file__)
|
62 |
|
63 |
+
#PAGES = {
|
64 |
+
# "Home": backend.home,
|
65 |
+
# "Demo": Demo,
|
66 |
+
# "About": backend.home
|
67 |
+
#}
|
68 |
|
69 |
+
#st.sidebar.title("SBSmapper")
|
70 |
+
#selection = st.sidebar.radio("Pages", list(PAGES.keys()))
|
71 |
|
72 |
+
#page = PAGES[selection]
|
73 |
# with st.spinner(f"Loading {selection} ..."):
|
74 |
#ast.shared.components.write_page(page)
|
75 |
|
76 |
+
#st.sidebar.header("Info")
|
77 |
+
#st.sidebar.write("Project by JA RAD")
|
78 |
#st.sidebar.write(
|
79 |
# "Pre-trained models are available on [HF Hub](https://huggingface.co/)"
|
80 |
#)
|
|
|
84 |
#st.sidebar.write(
|
85 |
# "App source code available on [GitHub](https://github.com/)"
|
86 |
#)
|
87 |
+
#if st.sidebar.checkbox("Show RAM usage"):
|
88 |
+
# ram = get_current_ram_usage()
|
89 |
+
# st.sidebar.write("Ram usage: {:.2f}/{:.2f} GB".format(ram[0], ram[1]))
|
90 |
|
91 |
"""
|
92 |
import os
|