Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from blogGenerator.ui.streamlit.loadui import LoadStreamlitUI | |
| from blogGenerator.LLMs.groqllm import GroqLLM | |
| from blogGenerator.graph.graph_builder import GraphBuilder | |
| from blogGenerator.ui.streamlit.display_result import DisplayResultStreamlit | |
| def load_blog_generator_agentic_ai_app(): | |
| # Load UI | |
| ui = LoadStreamlitUI() | |
| user_config = ui.load_streamlit_ui() | |
| if not user_config: | |
| st.error("Error: Failed to load user input from the UI.") | |
| return | |
| user_message = st.chat_input("Enter your message:") | |
| if user_message: | |
| try: | |
| st.write("Initialize Blog Generation....") | |
| # Configure LLM | |
| obj_llm_config = GroqLLM(user_controls_input=user_config) | |
| model = obj_llm_config.get_llm_model() | |
| if not model: | |
| st.error("Error: LLM model could not be initialized.") | |
| return | |
| ### Graph Builder | |
| graph_builder = GraphBuilder(model) | |
| try: | |
| graph = graph_builder.setup_graph() | |
| DisplayResultStreamlit(graph, user_message).display_result_on_ui() | |
| except Exception as e: | |
| st.error(f"Error: Graph setup failed - {e}") | |
| return | |
| except Exception as e: | |
| raise ValueError(f"Error Occurred with Exception : {e}") | |