Spaces:
Runtime error
Runtime error
Merge pull request #20 from beautiful-code/ui/mainpage
Browse files- ui/main.css +2 -2
- ui/til_feedback.py +26 -8
- ui_main.py +18 -25
ui/main.css
CHANGED
|
@@ -18,7 +18,7 @@ body {
|
|
| 18 |
text-align: center;
|
| 19 |
color: #333;
|
| 20 |
}
|
| 21 |
-
.card {
|
| 22 |
background-color: #f8f9fa;
|
| 23 |
border-radius: 10px;
|
| 24 |
padding: 20px;
|
|
@@ -37,5 +37,5 @@ body {
|
|
| 37 |
}
|
| 38 |
.card p {
|
| 39 |
color: #666;
|
| 40 |
-
}
|
| 41 |
|
|
|
|
| 18 |
text-align: center;
|
| 19 |
color: #333;
|
| 20 |
}
|
| 21 |
+
/* .card {
|
| 22 |
background-color: #f8f9fa;
|
| 23 |
border-radius: 10px;
|
| 24 |
padding: 20px;
|
|
|
|
| 37 |
}
|
| 38 |
.card p {
|
| 39 |
color: #666;
|
| 40 |
+
} */
|
| 41 |
|
ui/til_feedback.py
CHANGED
|
@@ -18,13 +18,32 @@ def main():
|
|
| 18 |
""",
|
| 19 |
unsafe_allow_html=True
|
| 20 |
)
|
| 21 |
-
til_content = st.text_area('Enter what you learnt today:',
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
if st.button("Get Feedback"):
|
| 30 |
with st.status(
|
|
@@ -51,6 +70,5 @@ def main():
|
|
| 51 |
if result.get('suggestion') is not None:
|
| 52 |
st.markdown(f"**Suggestion:** {result['suggestion']}")
|
| 53 |
|
| 54 |
-
|
| 55 |
if __name__ == "__main__":
|
| 56 |
main()
|
|
|
|
| 18 |
""",
|
| 19 |
unsafe_allow_html=True
|
| 20 |
)
|
| 21 |
+
# til_content = st.text_area('Enter what you learnt today:',
|
| 22 |
+
# "* Quantization is the process of reducing the size of LLM models by reducing the underlying weights.\n"
|
| 23 |
+
# "* The weights are reduced by scaling down the datatypes from a datatype that takes larger space to a data type that takes a smaller space, this is also known as downcasting.\n"
|
| 24 |
+
# "* Quantization offers benefits such as reduced storage space usage and faster computation.\n"
|
| 25 |
+
# "* Disadvantages: Answers are less precise\n"
|
| 26 |
+
# "* I learnt how to use Go Routines to handle concurrency in React.\n",
|
| 27 |
+
# key='til_content', help='Enter what you learnt today')
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
default_content = (
|
| 31 |
+
"* Quantization is the process of reducing the size of LLM models by reducing the underlying weights.\n"
|
| 32 |
+
"* The weights are reduced by scaling down the datatypes from a datatype that takes larger space to a data type that takes a smaller space, this is also known as downcasting.\n"
|
| 33 |
+
"* Quantization offers benefits such as reduced storage space usage and faster computation.\n"
|
| 34 |
+
"* Disadvantages: Answers are less precise\n"
|
| 35 |
+
"* I learnt how to use Go Routines to handle concurrency in React.\n"
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
if 'til_content' not in st.session_state:
|
| 39 |
+
st.session_state.til_content = default_content
|
| 40 |
+
|
| 41 |
+
til_content = st.text_area(
|
| 42 |
+
'Enter what you learnt today:',
|
| 43 |
+
value=st.session_state.til_content,
|
| 44 |
+
key='til_content',
|
| 45 |
+
help='Enter what you learnt today'
|
| 46 |
+
)
|
| 47 |
|
| 48 |
if st.button("Get Feedback"):
|
| 49 |
with st.status(
|
|
|
|
| 70 |
if result.get('suggestion') is not None:
|
| 71 |
st.markdown(f"**Suggestion:** {result['suggestion']}")
|
| 72 |
|
|
|
|
| 73 |
if __name__ == "__main__":
|
| 74 |
main()
|
ui_main.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
from streamlit_extras.stylable_container import stylable_container
|
| 4 |
from PIL import Image
|
|
@@ -39,44 +40,36 @@ def show_main_page():
|
|
| 39 |
st.markdown('<div class="sub-header">Navigate to Specific Pages:</div>', unsafe_allow_html=True)
|
| 40 |
|
| 41 |
card_info = [
|
| 42 |
-
{"title": "Article
|
| 43 |
{"title": "Recent Article Suggester", "description": "Get suggestions for recent research articles.", "key": "research_article_suggester"},
|
| 44 |
{"title": "Feedback", "description": "Provide your valuable feedback.", "key": "feedback"},
|
| 45 |
]
|
| 46 |
|
| 47 |
num_cols = 3
|
| 48 |
-
num_rows = (len(card_info)
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
for col in range(num_cols):
|
| 63 |
-
index = row * num_cols + col
|
| 64 |
-
if index < len(card_info):
|
| 65 |
-
card = card_info[index]
|
| 66 |
-
with cols[col]:
|
| 67 |
-
with stylable_container(
|
| 68 |
-
key="inside_container_with_border",
|
| 69 |
-
css_styles="""
|
| 70 |
-
{
|
| 71 |
-
height: 500px;
|
| 72 |
background-color: #f8f9fa;
|
| 73 |
border-radius: 10px;
|
| 74 |
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
|
| 75 |
display: flex;
|
|
|
|
|
|
|
| 76 |
justify-content: center;
|
| 77 |
align-items: center;
|
| 78 |
-
flex-wrap: wrap;
|
| 79 |
padding:10px;
|
|
|
|
| 80 |
""",
|
| 81 |
):
|
| 82 |
st.markdown(
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import math
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
from streamlit_extras.stylable_container import stylable_container
|
| 5 |
from PIL import Image
|
|
|
|
| 40 |
st.markdown('<div class="sub-header">Navigate to Specific Pages:</div>', unsafe_allow_html=True)
|
| 41 |
|
| 42 |
card_info = [
|
| 43 |
+
{"title": "Article Recommender", "description": "Discover articles tailored to your interests.", "key": "article_recommendor"},
|
| 44 |
{"title": "Recent Article Suggester", "description": "Get suggestions for recent research articles.", "key": "research_article_suggester"},
|
| 45 |
{"title": "Feedback", "description": "Provide your valuable feedback.", "key": "feedback"},
|
| 46 |
]
|
| 47 |
|
| 48 |
num_cols = 3
|
| 49 |
+
num_rows = math.ceil(len(card_info) / num_cols)
|
| 50 |
|
| 51 |
+
|
| 52 |
+
for row in range(num_rows):
|
| 53 |
+
cols = st.columns(num_cols)
|
| 54 |
+
for col in range(num_cols):
|
| 55 |
+
index = row * num_cols + col
|
| 56 |
+
if index < len(card_info):
|
| 57 |
+
card = card_info[index]
|
| 58 |
+
with cols[col]:
|
| 59 |
+
with stylable_container(
|
| 60 |
+
key="inside_container_with_border",
|
| 61 |
+
css_styles="""
|
| 62 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
background-color: #f8f9fa;
|
| 64 |
border-radius: 10px;
|
| 65 |
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
|
| 66 |
display: flex;
|
| 67 |
+
flex-wrap: wrap;
|
| 68 |
+
flex-direction: column;
|
| 69 |
justify-content: center;
|
| 70 |
align-items: center;
|
|
|
|
| 71 |
padding:10px;
|
| 72 |
+
margin:10px;
|
| 73 |
""",
|
| 74 |
):
|
| 75 |
st.markdown(
|