Spaces:
Sleeping
Sleeping
File size: 1,370 Bytes
ed65c68 |
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 |
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}")
|