Spaces:
Runtime error
Runtime error
File size: 4,777 Bytes
60ce749 1a74bcb f3f99ec c232c71 1a74bcb c232c71 f3f99ec 1a74bcb 60ce749 1a74bcb 60ce749 1a74bcb 68e1277 60ce749 68e1277 1a74bcb 60ce749 1a74bcb f3f99ec c232c71 1a74bcb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | from dotenv import load_dotenv
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
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,
)
st.set_page_config(layout="wide")
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("") # Adding a blank space here
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")
# json_data = json.loads(result)
# articles_list = json_data.get("articles", None)
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 __name__ == "__main__":
main()
|