WIP - Streamlit UI, Porting CLI

This commit is contained in:
ajaysi
2024-06-08 11:34:43 +05:30
parent adbefa79ef
commit 11aa649145
8 changed files with 77 additions and 31 deletions

21
LICENSE
View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2024 Alwrity
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,7 +1,7 @@
# How to Alwrity - Getting Started
Alwrity assists content creators and digital marketers in keyword web research, AI content generation, AI social media.
Our toolkit integrates advanced AI models for text generation, image creation, and data analysis, streamlining your content creation pipeline and ensuring high-quality output with minimal effort.
Alwrity assists content creators and digital marketers in keyword web research, AI website & Social media content generation & AI Copywriting.
Our toolkit integrates (OpenAI, Gemini) AI models for text generation, image creation(Stability.ai), STT(whisper, AssemblyAI) and Web or local data analysis, streamlining your content creation pipeline and ensuring high-quality output with minimal effort.
Prompting is abstracted to get going sooner. Focus on your content quality, rather than AI tooling around it.
Alwrity gives personalization, factual web researched & SEO optimized content and tools for automating content & digital marketing.
@@ -18,14 +18,23 @@ If you have 💻 Laptop + 🛜 Internet + 10 minutes, you will be generating blo
### [Step-By-Step: Getting Started for Absolute Begginers](https://www.alwrity.com/post/getting-started-with-alwrity-ai-writer)
---
### [Getting started for Developers](https://github.com/AJaySi/AI-Writer/wiki/Alwrity--%E2%80%90-Get-started)
`
Step1: git clone https://github.com/AJaySi/AI-Writer.git
Step2: pip install -r requirements.txt
Step3: streamlit run alwrity.py
Step4: Visit Alwrity UI in Browser & Start generation AI personalized content.
`
---
### Updating to latest Code: (Existing users)
`
1). Git pull
2). streamlit run alwrity.py
3). pip install -r requirements.txt
`
---
**Still stuck, [Open issue here](https://github.com/AJaySi/AI-Writer/issues) & Someone will bail you out.
---
@@ -169,3 +178,28 @@ Duh, scraping wont scale, that is GPT vision based scraping will come in handy.
10). The code is always a mess, lot of changes happening..
11). Focus is to stop making any more AI content tools, but rather revisit & improve user experience & content quality.
12). To Err is Human & AI....
---
LICENE
---
MIT License
Copyright (c) 2024 Alwrity
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -276,8 +276,25 @@ def write_prompts(prompts, file_path="prompt_llm.txt"):
for prompt in prompts:
file.write(f"{prompt}\n")
import base64
# Function to load and encode the image file
def load_image(image_path):
with open(image_path, "rb") as img_file:
b64_string = base64.b64encode(img_file.read()).decode()
return b64_string
# Load and encode the image
image_base64 = load_image("lib/workspace/alwrity_logo.png")
def main():
st.markdown("<div class='main-header'>Welcome to Alwrity!</div>", unsafe_allow_html=True)
# Use the encoded image in HTML
st.markdown(f"""
<div class='main-header'>
<img src='data:image/png;base64,{image_base64}' alt='Alwrity Logo' style='height: 50px; margin-right: 10px; vertical-align: middle;'>
Welcome to Alwrity!
</div>
""", unsafe_allow_html=True)
# Export the paths and file names. Dont want alwrity to be chatty and prompt for inputs.
os.environ["SEARCH_SAVE_FILE"] = os.path.join(os.getcwd(), "lib", "workspace", "web_research_report",
f"web_research_report_{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}")

View File

@@ -227,9 +227,15 @@ def ai_agents_planner(search_keywords):
#setup_environment()
try:
agents = create_agents(search_keywords, already_written_on)
except Exception as err:
st.error(f"Failed in Creating in Agents: {err}")
try:
tasks = create_tasks(agents, search_keywords, already_written_on)
except Exception as err:
st.error(f"Failed to Create Agent Tasks: {err}")
try:
result = execute_tasks(agents, tasks)
except Exception as err:
print(err)
st.error(f"Failed to execute Agent Tasks: {err}")
st.markdown("### Final Content Calender:")
st.markdown(result)

View File

@@ -1,8 +1,8 @@
{
"Blog Content Characteristics": {
"Blog Length": "2000",
"Blog Tone": "Customize",
"Blog Demographic": "Customize",
"Blog Tone": "Casual",
"Blog Demographic": "Professional",
"Blog Type": "Informational",
"Blog Language": "English",
"Blog Output Format": "markdown"

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

View File

@@ -3,7 +3,15 @@ body {
background: #f0f4f8;
background-image: linear-gradient(to bottom right, #d0e1f9, #e1ebf9);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0; /* Remove any default margin */
padding: 0; /* Remove any default padding */
}
.block-container {
padding-top: 2.5rem;
padding-bottom: 3rem;
padding-left: 5rem;
padding-right: 5rem;
}
/* Main header styling */
.main-header {
@@ -13,6 +21,7 @@ body {
margin-bottom: 20px;
text-align: center;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
padding-top: 10px; /* Add padding to the top to move it up */
}
/* Sub-header styling */
@@ -69,7 +78,7 @@ body {
margin-bottom: 30px;
border-radius: 10px;
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
background-color: #f8f8f8;
background-color: #f0f4f8; /* Change background to match body */
}
/* Input fields styling */
@@ -85,7 +94,7 @@ input[type="text"] {
/* Custom button styling */
button {
background: #1976D2;
background: #1565C0; /* Match tab color */
color: white;
border: none;
padding: 12px 24px;
@@ -102,7 +111,7 @@ button {
}
button:hover {
background-color: #1565C0;
background-color: #1976D2; /* Match tab hover color */
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

View File

@@ -26,5 +26,6 @@ prompt_toolkit
ipython
html2image
lxml_html_clean
streamlit
yfinance
pandas_ta