File size: 1,569 Bytes
1a1fd73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from agent import multi_agent_framework


# Define the multi agent framework
model_id = "Qwen/Qwen2.5-Coder-32B-Instruct"
agent = multi_agent_framework(model_id)

# Function to log agent actions
def log_agent_action(prompt, result):
    st.write(f"### Agent Activity")
    st.write("**Prompt Sent to Agent:**")
    st.code(prompt, language="text")
    st.write("**Agent Output:**")
    st.code(result, language="text")

# Streamlit app title
st.title("Multi Agent GPT")

# App description
st.write("Generate creative content, search the web and generate images enriched with the power of MultiAgent framework")

# Input blog topic or prompt
user_prompt = st.text_area("How may I help you?:", placeholder="E.g., Generate me a picture of cute puppy")

# Button to generate content
if st.button("Generate"):
    if user_prompt:
        with st.spinner("Generating content with our Multi agents"):
            try:
                # Run the agent with the given prompt
                result = agent.run(user_prompt)
                # Display the generated content
                st.subheader("Generated Content:")
                st.write(result)

                # Log backend activity
                log_agent_action(user_prompt, result)
            except Exception as e:
                st.error(f"An error occurred: {e}")
    else:
        st.warning("Please enter a prompt to proceed.")

# Footer
st.markdown("---")
st.caption("Powered by SmolAgents, DuckDuckGo, black-forest-labs and Streamlit")