Spaces:
Sleeping
Sleeping
Commit
·
e954dc8
1
Parent(s):
dd1c865
updated pythhon file locations
Browse files- app.py +43 -30
- src/research_agent/crew.py +1 -1
app.py
CHANGED
|
@@ -62,6 +62,10 @@ st.markdown("This is an Agent which can do Market Analysis and Generate Use Case
|
|
| 62 |
name = st.text_input("Enter Name of the company:", placeholder="e.g., Google, Apple, Nike")
|
| 63 |
link = st.text_input("Enter the company's link:", placeholder="e.g., https://www.google.com, https://www.apple.com, https://www.nike.com")
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
# Button to generate article
|
| 66 |
if st.button("Generate Article"):
|
| 67 |
# Check if API keys are provided
|
|
@@ -93,45 +97,54 @@ if st.button("Generate Article"):
|
|
| 93 |
|
| 94 |
# Extract the article text from the result
|
| 95 |
if isinstance(result, str):
|
| 96 |
-
article_text = result
|
| 97 |
elif isinstance(result, dict) and 'article' in result:
|
| 98 |
-
article_text = result['article']
|
| 99 |
else:
|
| 100 |
-
article_text = str(result)
|
| 101 |
|
| 102 |
# Display the article text
|
| 103 |
-
st.markdown(article_text)
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
| 110 |
st.download_button(
|
| 111 |
-
label="Download
|
| 112 |
-
data=
|
| 113 |
-
file_name=f"{name.replace(' ', '_').lower()}
|
| 114 |
mime="text/plain"
|
| 115 |
)
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
| 125 |
)
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
with col3:
|
| 129 |
-
with open("output/resouce.md", "rb") as fp:
|
| 130 |
-
st.download_button(
|
| 131 |
-
label="Download Ideas",
|
| 132 |
-
data=fp,
|
| 133 |
-
file_name=f"{name.replace(' ', '_').lower()}_ideas.txt",
|
| 134 |
-
mime="image/txt"
|
| 135 |
-
)
|
| 136 |
|
| 137 |
st.markdown("---------")
|
|
|
|
|
|
| 62 |
name = st.text_input("Enter Name of the company:", placeholder="e.g., Google, Apple, Nike")
|
| 63 |
link = st.text_input("Enter the company's link:", placeholder="e.g., https://www.google.com, https://www.apple.com, https://www.nike.com")
|
| 64 |
|
| 65 |
+
# Initialize session state if not present
|
| 66 |
+
if 'article_text' not in st.session_state:
|
| 67 |
+
st.session_state.article_text = ""
|
| 68 |
+
|
| 69 |
# Button to generate article
|
| 70 |
if st.button("Generate Article"):
|
| 71 |
# Check if API keys are provided
|
|
|
|
| 97 |
|
| 98 |
# Extract the article text from the result
|
| 99 |
if isinstance(result, str):
|
| 100 |
+
st.session_state.article_text = result
|
| 101 |
elif isinstance(result, dict) and 'article' in result:
|
| 102 |
+
st.session_state.article_text = result['article']
|
| 103 |
else:
|
| 104 |
+
st.session_state.article_text = str(result)
|
| 105 |
|
| 106 |
# Display the article text
|
| 107 |
+
st.markdown(st.session_state.article_text)
|
| 108 |
+
|
| 109 |
+
# Create three columns for download buttons
|
| 110 |
+
col1, col2, col3 = st.columns(3)
|
| 111 |
|
| 112 |
+
# Download button for the article
|
| 113 |
+
with col1:
|
| 114 |
+
if st.session_state.article_text:
|
| 115 |
+
st.download_button(
|
| 116 |
+
label="Download Article",
|
| 117 |
+
data=st.session_state.article_text,
|
| 118 |
+
file_name=f"{name.replace(' ', '_').lower()}_market_and_use_case_analysis.txt",
|
| 119 |
+
mime="text/plain"
|
| 120 |
+
)
|
| 121 |
+
else:
|
| 122 |
+
st.write("Article not generated yet.")
|
| 123 |
|
| 124 |
+
# Download button for ideas
|
| 125 |
+
with col2:
|
| 126 |
+
if st.session_state.article_text:
|
| 127 |
+
with open("output/ideas.md", "rb") as fp:
|
| 128 |
st.download_button(
|
| 129 |
+
label="Download Ideas",
|
| 130 |
+
data=fp,
|
| 131 |
+
file_name=f"{name.replace(' ', '_').lower()}_ideas.txt",
|
| 132 |
mime="text/plain"
|
| 133 |
)
|
| 134 |
+
else:
|
| 135 |
+
st.wrtie("Ideas are ideating")
|
| 136 |
+
# Download button for resources
|
| 137 |
+
with col3:
|
| 138 |
+
if st.session_state.article_text:
|
| 139 |
+
with open("output/resouce.md", "rb") as fp:
|
| 140 |
+
st.download_button(
|
| 141 |
+
label="Download Resources",
|
| 142 |
+
data=fp,
|
| 143 |
+
file_name=f"{name.replace(' ', '_').lower()}_resources.txt",
|
| 144 |
+
mime="text/plain"
|
| 145 |
)
|
| 146 |
+
else:
|
| 147 |
+
st.write("Resources are being researched")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
st.markdown("---------")
|
| 150 |
+
|
src/research_agent/crew.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import sys
|
| 2 |
from crewai import Agent, Crew, Process, Task, LLM
|
| 3 |
from crewai.project import CrewBase, agent, crew, task
|
| 4 |
-
from research_agent.tools.tool import search_tool, website_search_tool,pdf_search_tool
|
| 5 |
import streamlit as st
|
| 6 |
import os
|
| 7 |
sys.path.append('..')
|
|
|
|
| 1 |
import sys
|
| 2 |
from crewai import Agent, Crew, Process, Task, LLM
|
| 3 |
from crewai.project import CrewBase, agent, crew, task
|
| 4 |
+
from src.research_agent.tools.tool import search_tool, website_search_tool,pdf_search_tool
|
| 5 |
import streamlit as st
|
| 6 |
import os
|
| 7 |
sys.path.append('..')
|