AdamyaG commited on
Commit
4ab7dba
·
verified ·
1 Parent(s): 156d9d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -45
app.py CHANGED
@@ -1,46 +1,52 @@
1
- import streamlit as st
2
- from agent import multi_agent_framework
3
-
4
-
5
- # Define the multi agent framework
6
- model_id = "Qwen/Qwen2.5-Coder-32B-Instruct"
7
- agent = multi_agent_framework(model_id)
8
-
9
- # Function to log agent actions
10
- def log_agent_action(prompt, result):
11
- st.write(f"### Agent Activity")
12
- st.write("**Prompt Sent to Agent:**")
13
- st.code(prompt, language="text")
14
- st.write("**Agent Output:**")
15
- st.code(result, language="text")
16
-
17
- # Streamlit app title
18
- st.title("Multi Agent GPT")
19
-
20
- # App description
21
- st.write("Generate creative content, search the web and generate images enriched with the power of MultiAgent framework")
22
-
23
- # Input blog topic or prompt
24
- user_prompt = st.text_area("How may I help you?:", placeholder="E.g., Generate me a picture of cute puppy")
25
-
26
- # Button to generate content
27
- if st.button("Generate"):
28
- if user_prompt:
29
- with st.spinner("Generating content with our Multi agents"):
30
- try:
31
- # Run the agent with the given prompt
32
- result = agent.run(user_prompt)
33
- # Display the generated content
34
- st.subheader("Generated Content:")
35
- st.write(result)
36
-
37
- # Log backend activity
38
- log_agent_action(user_prompt, result)
39
- except Exception as e:
40
- st.error(f"An error occurred: {e}")
41
- else:
42
- st.warning("Please enter a prompt to proceed.")
43
-
44
- # Footer
45
- st.markdown("---")
 
 
 
 
 
 
46
  st.caption("Powered by SmolAgents, DuckDuckGo, black-forest-labs and Streamlit")
 
1
+ import streamlit as st
2
+ from agent import multi_agent_framework
3
+
4
+
5
+ # Define the multi agent framework
6
+ model_id = "Qwen/Qwen2.5-Coder-32B-Instruct"
7
+ agent = multi_agent_framework(model_id)
8
+
9
+ # Function to log agent actions
10
+ def log_agent_action(prompt, activity, result):
11
+ st.write(f"### Agent Activity")
12
+ st.write("**Prompt Sent to Agent:**")
13
+ st.code(prompt, language="text")
14
+ at.write("**Agent Activity:**")
15
+ st.code(activity, language="text")
16
+ st.write("**Agent Output:**")
17
+ st.code(result, language="text")
18
+
19
+ # Streamlit app title
20
+ st.title("Multi Agent GPT")
21
+
22
+ # App description
23
+ st.write("Generate creative content, search the web and generate images enriched with the power of MultiAgent framework")
24
+
25
+ # Input blog topic or prompt
26
+ user_prompt = st.text_area("How may I help you?:", placeholder="E.g., Generate me a picture of cute puppy")
27
+
28
+ # Button to generate content
29
+ if st.button("Generate"):
30
+ if user_prompt:
31
+ with st.spinner("Generating content with our Multi agents"):
32
+ try:
33
+ # Run the agent with the given prompt
34
+ buffer = io.StringIO()
35
+ sys.stdout = buffer
36
+ result = agent.run(user_prompt)
37
+ # Display the generated content
38
+ st.subheader("Generated Content:")
39
+ st.write(result)
40
+
41
+ # Log backend activity
42
+ sys.stdout = sys.__stdout__
43
+ activity = buffer.getvalue()
44
+ log_agent_action(user_prompt, activity, result)
45
+ except Exception as e:
46
+ st.error(f"An error occurred: {e}")
47
+ else:
48
+ st.warning("Please enter a prompt to proceed.")
49
+
50
+ # Footer
51
+ st.markdown("---")
52
  st.caption("Powered by SmolAgents, DuckDuckGo, black-forest-labs and Streamlit")