Spaces:
Runtime error
Runtime error
Merge pull request #12 from beautiful-code/ui/refractor
Browse files
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
title: AI Workflows
|
| 3 |
-
app_file:
|
| 4 |
sdk: streamlit
|
| 5 |
sdk_version: 1.35.0
|
| 6 |
pinned: false
|
|
|
|
| 1 |
---
|
| 2 |
title: AI Workflows
|
| 3 |
+
app_file: main.py
|
| 4 |
sdk: streamlit
|
| 5 |
sdk_version: 1.35.0
|
| 6 |
pinned: false
|
app.py
CHANGED
|
@@ -1,14 +1,11 @@
|
|
| 1 |
from dotenv import load_dotenv
|
| 2 |
-
load_dotenv()
|
| 3 |
-
|
| 4 |
import json
|
| 5 |
import streamlit as st
|
| 6 |
-
|
| 7 |
import utils.settings as settings
|
| 8 |
|
| 9 |
from crew.article_suggestion import article_recommendation_crew
|
| 10 |
from utils.write_to_json import write_dict_to_json as write_dict_to_json
|
| 11 |
-
|
| 12 |
settings.init()
|
| 13 |
|
| 14 |
|
|
@@ -20,9 +17,6 @@ def icon(emoji: str):
|
|
| 20 |
)
|
| 21 |
|
| 22 |
|
| 23 |
-
st.set_page_config(layout="wide")
|
| 24 |
-
|
| 25 |
-
|
| 26 |
def main():
|
| 27 |
icon("📖 Articles RecommendAIgent")
|
| 28 |
st.subheader("Let AI agents recommend articles based on your interest!")
|
|
@@ -55,7 +49,7 @@ def main():
|
|
| 55 |
"Disadvantages of Quantization: Less precise.\n\n",
|
| 56 |
height=400,
|
| 57 |
)
|
| 58 |
-
st.markdown("")
|
| 59 |
submitted = st.form_submit_button("Submit")
|
| 60 |
|
| 61 |
if submitted:
|
|
@@ -77,8 +71,6 @@ def main():
|
|
| 77 |
|
| 78 |
st.subheader("", anchor=False, divider="rainbow")
|
| 79 |
|
| 80 |
-
# json_data = json.loads(result)
|
| 81 |
-
# articles_list = json_data.get("articles", None)
|
| 82 |
articles_list = settings.articles.values()
|
| 83 |
|
| 84 |
if articles_list is None:
|
|
@@ -94,6 +86,7 @@ def main():
|
|
| 94 |
st.markdown(f"**Reason For Recommendation:** {article.get('reason_for_recommendation', '')}")
|
| 95 |
st.markdown("---")
|
| 96 |
|
| 97 |
-
|
|
|
|
| 98 |
if __name__ == "__main__":
|
| 99 |
main()
|
|
|
|
| 1 |
from dotenv import load_dotenv
|
|
|
|
|
|
|
| 2 |
import json
|
| 3 |
import streamlit as st
|
|
|
|
| 4 |
import utils.settings as settings
|
| 5 |
|
| 6 |
from crew.article_suggestion import article_recommendation_crew
|
| 7 |
from utils.write_to_json import write_dict_to_json as write_dict_to_json
|
| 8 |
+
load_dotenv()
|
| 9 |
settings.init()
|
| 10 |
|
| 11 |
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
def main():
|
| 21 |
icon("📖 Articles RecommendAIgent")
|
| 22 |
st.subheader("Let AI agents recommend articles based on your interest!")
|
|
|
|
| 49 |
"Disadvantages of Quantization: Less precise.\n\n",
|
| 50 |
height=400,
|
| 51 |
)
|
| 52 |
+
st.markdown("")
|
| 53 |
submitted = st.form_submit_button("Submit")
|
| 54 |
|
| 55 |
if submitted:
|
|
|
|
| 71 |
|
| 72 |
st.subheader("", anchor=False, divider="rainbow")
|
| 73 |
|
|
|
|
|
|
|
| 74 |
articles_list = settings.articles.values()
|
| 75 |
|
| 76 |
if articles_list is None:
|
|
|
|
| 86 |
st.markdown(f"**Reason For Recommendation:** {article.get('reason_for_recommendation', '')}")
|
| 87 |
st.markdown("---")
|
| 88 |
|
| 89 |
+
if st.sidebar.button("← Back to Main Page"):
|
| 90 |
+
st.session_state.page = "main"
|
| 91 |
if __name__ == "__main__":
|
| 92 |
main()
|
main.css
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
body {
|
| 2 |
+
background-color: white;
|
| 3 |
+
color: #333;
|
| 4 |
+
font-family: 'Arial', sans-serif;
|
| 5 |
+
margin: 0;
|
| 6 |
+
padding: 0;
|
| 7 |
+
}
|
| 8 |
+
.main-title {
|
| 9 |
+
font-size: 3em;
|
| 10 |
+
font-weight: bold;
|
| 11 |
+
margin-top: 20px;
|
| 12 |
+
text-align: center;
|
| 13 |
+
color: #007bff;
|
| 14 |
+
}
|
| 15 |
+
.sub-header {
|
| 16 |
+
font-size: 1.5em;
|
| 17 |
+
margin: 20px 0;
|
| 18 |
+
text-align: center;
|
| 19 |
+
color: #333;
|
| 20 |
+
}
|
| 21 |
+
.card {
|
| 22 |
+
background-color: #f8f9fa;
|
| 23 |
+
border-radius: 10px;
|
| 24 |
+
padding: 20px;
|
| 25 |
+
margin: 20px;
|
| 26 |
+
height:300px;
|
| 27 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 28 |
+
display: flex;
|
| 29 |
+
flex-direction: column;
|
| 30 |
+
justify-content: center;
|
| 31 |
+
align-items: center;
|
| 32 |
+
text-align: center;
|
| 33 |
+
}
|
| 34 |
+
.card h2 {
|
| 35 |
+
font-size: 1.5em;
|
| 36 |
+
color: #007bff;
|
| 37 |
+
}
|
| 38 |
+
.card p {
|
| 39 |
+
color: #666;
|
| 40 |
+
}
|
| 41 |
+
|
main.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 5 |
+
from app import main as article_recommendor_main
|
| 6 |
+
from research_paper import main as research_article_suggester_main
|
| 7 |
+
from test import main as feedback_main
|
| 8 |
+
|
| 9 |
+
load_dotenv()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
st.set_page_config(page_title='Multi-Page App', page_icon='📰', layout='wide')
|
| 13 |
+
|
| 14 |
+
def load_css(file_name):
|
| 15 |
+
with open(file_name) as f:
|
| 16 |
+
return f.read()
|
| 17 |
+
|
| 18 |
+
def main():
|
| 19 |
+
|
| 20 |
+
if 'page' not in st.session_state:
|
| 21 |
+
st.session_state.page = "main"
|
| 22 |
+
|
| 23 |
+
if st.session_state.page == "main":
|
| 24 |
+
show_main_page()
|
| 25 |
+
elif st.session_state.page == "article_recommendor":
|
| 26 |
+
article_recommendor_main()
|
| 27 |
+
elif st.session_state.page == "research_article_suggester":
|
| 28 |
+
research_article_suggester_main()
|
| 29 |
+
elif st.session_state.page == "feedback":
|
| 30 |
+
feedback_main()
|
| 31 |
+
|
| 32 |
+
def show_main_page():
|
| 33 |
+
|
| 34 |
+
css = load_css("main.css")
|
| 35 |
+
st.markdown(f"<style>{css}</style>", unsafe_allow_html=True)
|
| 36 |
+
|
| 37 |
+
st.markdown('<div class="main-title">Welcome to the Multi-Page App!</div>', unsafe_allow_html=True)
|
| 38 |
+
st.markdown("---")
|
| 39 |
+
st.markdown('<div class="sub-header">Navigate to Specific Pages:</div>', unsafe_allow_html=True)
|
| 40 |
+
|
| 41 |
+
card_info = [
|
| 42 |
+
{"title": "Article Recommendor", "description": "Discover articles tailored to your interests.", "key": "article_recommendor"},
|
| 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) + num_cols - 1) // num_cols
|
| 49 |
+
|
| 50 |
+
with stylable_container(
|
| 51 |
+
key="container_with_border",
|
| 52 |
+
css_styles="""
|
| 53 |
+
{
|
| 54 |
+
display: flex;
|
| 55 |
+
align-items: center;
|
| 56 |
+
flex-wrap: wrap;
|
| 57 |
+
}
|
| 58 |
+
""",
|
| 59 |
+
):
|
| 60 |
+
for row in range(num_rows):
|
| 61 |
+
cols = st.columns(num_cols)
|
| 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(
|
| 83 |
+
f'''
|
| 84 |
+
<div class="card">
|
| 85 |
+
<h2>{card["title"]}</h2>
|
| 86 |
+
<p>{card["description"]}</p>
|
| 87 |
+
</div>
|
| 88 |
+
''', unsafe_allow_html=True)
|
| 89 |
+
if st.button(f"Go to {card['title']}", key=card["key"]):
|
| 90 |
+
st.session_state.page = card["key"]
|
| 91 |
+
|
| 92 |
+
if __name__ == '__main__':
|
| 93 |
+
main()
|
research_paper.py
CHANGED
|
@@ -2,9 +2,10 @@ import streamlit as st
|
|
| 2 |
from crew.research_article_suggester import RecentArticleSuggester
|
| 3 |
from streamlit_extras.capture import stdout
|
| 4 |
|
| 5 |
-
def main():
|
| 6 |
-
st.set_page_config(page_title='Recent Article Suggester', page_icon='📰', layout='wide')
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
st.markdown(
|
| 9 |
"""
|
| 10 |
<style>
|
|
@@ -125,6 +126,7 @@ def main():
|
|
| 125 |
""",
|
| 126 |
unsafe_allow_html=True
|
| 127 |
)
|
| 128 |
-
|
|
|
|
| 129 |
if __name__ == "__main__":
|
| 130 |
main()
|
|
|
|
| 2 |
from crew.research_article_suggester import RecentArticleSuggester
|
| 3 |
from streamlit_extras.capture import stdout
|
| 4 |
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
|
| 7 |
+
def main():
|
| 8 |
+
|
| 9 |
st.markdown(
|
| 10 |
"""
|
| 11 |
<style>
|
|
|
|
| 126 |
""",
|
| 127 |
unsafe_allow_html=True
|
| 128 |
)
|
| 129 |
+
if st.sidebar.button("← Back to Main Page"):
|
| 130 |
+
st.session_state.page = "main"
|
| 131 |
if __name__ == "__main__":
|
| 132 |
main()
|
test.py
CHANGED
|
@@ -5,16 +5,8 @@ from crew.til import TilCrew
|
|
| 5 |
import streamlit as st
|
| 6 |
from streamlit_extras.capture import stdout
|
| 7 |
|
| 8 |
-
# crew = TilCrew()
|
| 9 |
-
# results = crew.kickoff(inputs={"content": "Today I learnt Sidecar pattern"})
|
| 10 |
-
# results = crew.kickoff(inputs={"content": "Learnt about go-lang routines to add concurrency in the React App."})
|
| 11 |
-
# results = crew.kickoff(inputs={"content": "Upon delving into the intricacies of Docker, I have acquired the capability to encapsulate our application within containers, thereby streamlining the deployment process across a multitude of heterogeneous environments."})
|
| 12 |
-
# print(results)
|
| 13 |
-
|
| 14 |
|
| 15 |
def main():
|
| 16 |
-
st.set_page_config(page_title='Today I Learnt',
|
| 17 |
-
page_icon='📰', layout='wide')
|
| 18 |
st.markdown("<div class='container'>", unsafe_allow_html=True)
|
| 19 |
|
| 20 |
st.markdown(
|
|
|
|
| 5 |
import streamlit as st
|
| 6 |
from streamlit_extras.capture import stdout
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def main():
|
|
|
|
|
|
|
| 10 |
st.markdown("<div class='container'>", unsafe_allow_html=True)
|
| 11 |
|
| 12 |
st.markdown(
|