Spaces:
Sleeping
Sleeping
| from dotenv import load_dotenv | |
| import json | |
| import streamlit as st | |
| import utils.settings as settings | |
| from crew.article_suggestion import article_recommendation_crew | |
| from utils.write_to_json import write_dict_to_json as write_dict_to_json | |
| load_dotenv() | |
| settings.init() | |
| def icon(emoji: str): | |
| """Shows an emoji as a Notion-style page icon.""" | |
| st.write( | |
| f'<span style="font-size: 78px; line-height: 1">{emoji}</span>', | |
| unsafe_allow_html=True, | |
| ) | |
| def main(): | |
| icon("📖 Articles RecommendAIgent") | |
| st.subheader("Let AI agents recommend articles based on your interest!") | |
| with st.sidebar: | |
| st.header("👇 Provide Your Interests Below!") | |
| with st.form("user_input_form", border=True): | |
| interests = st.text_input( | |
| "Enter your interests (comma-separated):", | |
| "GenAI, Architecture, Agentic Programming", | |
| ) | |
| previous_article_insights = st.text_area( | |
| "Enter previous article insights:", | |
| "Agentic Design Patterns (https://www.deeplearning.ai/the-batch/how-agents-can-improve-llm-performance/)\n" | |
| "Reflection: The LLM examines its own work to come up with ways to improve it. " | |
| "Tool Use: The LLM is given tools such as web search, code execution, or any other function to help it gather information, take action, or process data. " | |
| "Planning: The LLM comes up with, and executes, a multistep plan to achieve a goal " | |
| "Multi-agent collaboration: More than one AI agent work together, splitting up tasks and discussing and debating ideas, to come up with better solutions than a single agent would.\n\n" | |
| "GenAI Multi-Agent Systems (https://thenewstack.io/genai-multi-agent-systems-a-secret-weapon-for-tech-teams/)\n" | |
| "Multi-agent systems go beyond the task-oriented roles to truly super-charge development and strategy teams. " | |
| "Successful multi-agent systems act as a “digital twin” for your development team. " | |
| "Different Approaches: 1. Centralized, with one agent in the center that collects and assimilates all the other outputs. " | |
| "2. Distributed, where there is no central controller and the agents coordinate directly with one another in an “agent swarm. " | |
| "3. Hierarchical, where agents are organized in teams or hierarchical layers.\n\n" | |
| "LLM Model Quantisation\n" | |
| "Different Methods for Compression: Pruning, Knowledge Distiallation and Quantization." | |
| "Quantization process represents the model weights in lower precession which is also known as downcasting." | |
| "Quanitzatoin Error is the difference in the weights of the quantized model and the original model." | |
| "Advantages of Quanitzation: Reduced memory footprint, increased compute and speed of inferrence." | |
| "Disadvantages of Quantization: Less precise.\n\n", | |
| height=400, | |
| ) | |
| st.markdown("") | |
| submitted = st.form_submit_button("Submit") | |
| if submitted: | |
| with st.status( | |
| "🤖 **Agents at work...**", state="running", expanded=True | |
| ) as status: | |
| with st.container(height=500, border=False): | |
| result = article_recommendation_crew.kickoff( | |
| inputs={ | |
| "interests": interests, | |
| "previous_article_insights": previous_article_insights, | |
| } | |
| ) | |
| status.update( | |
| label="✅ Articles are Ready for Reading!", | |
| state="complete", | |
| expanded=False, | |
| ) | |
| st.subheader("", anchor=False, divider="rainbow") | |
| articles_list = settings.articles.values() | |
| if articles_list is None: | |
| st.markdown("No articles found.") | |
| return | |
| else: | |
| for article in articles_list: | |
| st.markdown(f"# {article['title']}") | |
| st.markdown(f"**URL:** [{article['url']}]({article['url']})") | |
| st.markdown(f"**Pitch:** {article.get('pitch', '')}") | |
| st.markdown(f"**Evaluation Score:** {article.get('evaluation_score', '')}") | |
| st.markdown(f"**Evaluation Reason:** {article.get('evaluation_reason', '')}") | |
| st.markdown(f"**Reason For Recommendation:** {article.get('reason_for_recommendation', '')}") | |
| st.markdown("---") | |
| if st.sidebar.button("← Back to Main Page"): | |
| st.session_state.page = "main" | |
| if __name__ == "__main__": | |
| main() | |