init!
Browse files- LICENSE +21 -0
- README.md +158 -13
- auto_bot_1.png +0 -0
- auto_bot_2.png +0 -0
- autobot2.png +0 -0
- codex.png +0 -0
- megabot.png +0 -0
- requirements.txt +9 -0
- streamlit_app.py +492 -0
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2024 Sandeep Kasturi
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
README.md
CHANGED
@@ -1,13 +1,158 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
![Logo]([https://](https://autobots.streamlit.app/~/+/media/6fccba9d58db2500bc016561cb7ed354b3f7bb72e1c9b102ac98cef4.png))
|
3 |
+
|
4 |
+
**Welcome to AutoBot π€**
|
5 |
+
|
6 |
+
Interactive Chatbot build with Python Streamlit, Leveraging Gemini-pro API to the Application
|
7 |
+
|
8 |
+
**AutoBot AI**
|
9 |
+
|
10 |
+
Functionalities:
|
11 |
+
|
12 |
+
**AI Chatbot**
|
13 |
+
|
14 |
+
**CODEX**
|
15 |
+
|
16 |
+
**Web Scrapper**
|
17 |
+
|
18 |
+
**Github Codespaces**
|
19 |
+
|
20 |
+
**Mega Bot**
|
21 |
+
|
22 |
+
AutoBot, powered by the Gemini API, is a basic chatbot designed for automation. It excels in writing code and generating downloadable files with a .txt extension, offering the ability to handle up to 60 queries per minute.
|
23 |
+
|
24 |
+
Named for its automation capabilities, AutoBot combines "Auto" for continuous work and "Bot" for an intelligent machine that works for you.
|
25 |
+
|
26 |
+
Why choose AutoBot? Unlike other chatbots, AutoBot offers unlimited prompts and responses to the Google AI model, leveraging Gemini-pro. It's particularly effective for basic web development tasks.
|
27 |
+
|
28 |
+
Developed by SKAV TECH, a company focused on creating practical AI projects, AutoBot is intended for educational purposes only. We do not endorse any illegal or unethical activities.
|
29 |
+
|
30 |
+
Explaining each Functionalities:
|
31 |
+
|
32 |
+
1. **AI Chatbot**
|
33 |
+
AutoBot is effective for code generation, if your prompt contains code generation then you can get Downloadable files.
|
34 |
+
|
35 |
+
2. **CODEX**
|
36 |
+
CODEX Interactive CODING GUIDE, No one can explain Code like me trust me, Trust is the Most expensive thing Cheap people can't afford it.
|
37 |
+
|
38 |
+
You can ask specific code or content using the phase @codex "prompt"
|
39 |
+
You can upload your code here to ask the CODEX to generate Explanation (for eg. @codex Can you explain me this code in the file "filename"
|
40 |
+
I can Generate 60 queries per minute Pretty wild right, Haha more to see and Explore.
|
41 |
+
Example prompt: @codex explain me the code in the file "your_file_name"
|
42 |
+
|
43 |
+
Some popular Prompts:.
|
44 |
+
1. @codex explain me the code in the file app.py
|
45 |
+
2. @codex how does this code works in the file app.py
|
46 |
+
3. @codex can you explain me this code how does it works: "paste your code"
|
47 |
+
|
48 |
+
use @codex phase to start the prompt
|
49 |
+
|
50 |
+
3. **Web Scapper**
|
51 |
+
A tool that is build with Python, this gathers the contents of Websites using requests, Keep in mind this tool is for educational purpose only, You can get a clone of any website content by pasting down the URL of the Offical website in the tool
|
52 |
+
|
53 |
+
4. **Github Codespaces**
|
54 |
+
Providing the time to the user not to open VS code on Windows, while we provide an Web interaction to Vs code through Github Codespaces.
|
55 |
+
|
56 |
+
5. **Mega Bot**
|
57 |
+
Multi Model capability at finger tips.
|
58 |
+
|
59 |
+
Steps to install and Run AutoBot:
|
60 |
+
**STEP-1:**
|
61 |
+
Open Command Prompt and Type the followed command, Clone the Github repo into your system:
|
62 |
+
>=> git clone https://github.com/Sandeepkasturi/Auto-bot-ai.git.
|
63 |
+
|
64 |
+
>=> cd Auto-bot-ai
|
65 |
+
|
66 |
+
Now On you Directory where AutoBot AI folder is present, Make changes in the code where you find st.secrets[api_key]
|
67 |
+
This thing is actually hides the API key from Public, you can generate your own Gemini-AI API key at Google AI Studio **https://aistudio.google.com/app/apikey**
|
68 |
+
## Authors
|
69 |
+
|
70 |
+
- [@sandeepkasturi](https://www.github.com/sandeepkasturi)
|
71 |
+
|
72 |
+
|
73 |
+
## π About Me
|
74 |
+
I'm a Prompt Engineer...
|
75 |
+
|
76 |
+
|
77 |
+
## Contributing
|
78 |
+
|
79 |
+
Contributions are always welcome!
|
80 |
+
|
81 |
+
See `contributing.md` for ways to get started.
|
82 |
+
|
83 |
+
Please adhere to this project's `code of conduct`.
|
84 |
+
|
85 |
+
|
86 |
+
## Demo
|
87 |
+
|
88 |
+
Here is the link to demo
|
89 |
+
|
90 |
+
https://youtu.be/i0Q-NBrYpPI
|
91 |
+
## Badges
|
92 |
+
|
93 |
+
|
94 |
+
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
|
95 |
+
|
96 |
+
Hi ![](https://user-images.githubusercontent.com/18350557/176309783-0785949b-9127-417c-8b55-ab5a4333674e.gif)
|
97 |
+
My name is Sandeep Kasturi
|
98 |
+
=======================================================================================================================================
|
99 |
+
Founder of SKAV TECH
|
100 |
+
---------------
|
101 |
+
|
102 |
+
I've been learning to code for 5 years, after switching careers. I started with Python, but have really found a passion for AI Development and I started SKAV TECH a NO CODE Development platform combined with AI tools and Experienced Prompt Engineers.
|
103 |
+
|
104 |
+
* πΒ I'm based in India
|
105 |
+
* π₯οΈΒ Our [Company](http://skavtech.mydurable.com)
|
106 |
+
* βοΈΒ You can contact me at [[email protected]](mailto:[email protected])
|
107 |
+
* πΒ I'm currently working on [SKAV AI](http://skstores.xyz)
|
108 |
+
* π§ Β I'm learning AI
|
109 |
+
* π€Β I'm open to collaborating on [Instagram](https://instagram.com/sandeep_kasturi_)
|
110 |
+
* β‘Β I'm secretly Developing some AI applications which can change my career. Updates will be posted on Instagram,
|
111 |
+
|
112 |
+
## Installation
|
113 |
+
|
114 |
+
Install AutoBot with Command Prompt
|
115 |
+
|
116 |
+
```bash
|
117 |
+
git clone https://github.com/Sandeepkasturi/Auto-bot-ai.git
|
118 |
+
cd Auto-bot-ai
|
119 |
+
```
|
120 |
+
After Installation you need to make changes in the Code. That is setting up your own Gemini API key.
|
121 |
+
In the Streamlit_app.py
|
122 |
+
You can find the code line : **configure(api_key=st.secrets["api_key"])**
|
123 |
+
|
124 |
+
You need to Update the code:
|
125 |
+
configure(api_key="Your_api_key")
|
126 |
+
Now Open Command Prompt and follow the commands below
|
127 |
+
```bash
|
128 |
+
pip install -r requirements.txt
|
129 |
+
|
130 |
+
streamlit run streamlit_app.py
|
131 |
+
```
|
132 |
+
|
133 |
+
## Running Tests
|
134 |
+
|
135 |
+
To run tests, run the following command
|
136 |
+
|
137 |
+
```bash
|
138 |
+
streamlit run streamlit_app.py
|
139 |
+
```
|
140 |
+
|
141 |
+
|
142 |
+
## Tech Stack
|
143 |
+
|
144 |
+
**Python Streamlit**
|
145 |
+
|
146 |
+
|
147 |
+
## Deployment
|
148 |
+
|
149 |
+
To deploy this project you need to setup Streamlit Cloud with Github
|
150 |
+
|
151 |
+
|
152 |
+
## Used By
|
153 |
+
|
154 |
+
This project is used by the following companies:
|
155 |
+
|
156 |
+
- [SynkWave](https://skstores.xyz)
|
157 |
+
- [SKAV TECH](https://skavtech.mydurable.com)
|
158 |
+
|
auto_bot_1.png
ADDED
auto_bot_2.png
ADDED
autobot2.png
ADDED
codex.png
ADDED
megabot.png
ADDED
requirements.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import streamlit as st
|
3 |
+
import requests
|
4 |
+
import webbrowser
|
5 |
+
import time
|
6 |
+
import base64
|
7 |
+
from google.generativeai import configure, GenerativeModel
|
8 |
+
import streamlit.components.v1 as components
|
9 |
+
from urllib.parse import urlparse
|
10 |
+
from streamlit_lottie import st_lottie
|
11 |
+
from together import Together
|
12 |
+
import smtplib
|
13 |
+
from email.mime.multipart import MIMEMultipart
|
14 |
+
from email.mime.text import MIMEText
|
15 |
+
from email.mime.base import MIMEBase
|
16 |
+
from email import encoders
|
17 |
+
from email.utils import formataddr
|
18 |
+
from io import BytesIO
|
19 |
+
from PIL import Image
|
20 |
+
|
21 |
+
# Configure the Generative AI and Together clients
|
22 |
+
configure(api_key=st.secrets["api_key"])
|
23 |
+
model = GenerativeModel('gemini-pro')
|
24 |
+
together_api_key = st.secrets["together_api_key"]
|
25 |
+
client = Together(api_key=together_api_key)
|
26 |
+
|
27 |
+
|
28 |
+
# Email sending function
|
29 |
+
def send_email(subject, body, to_email, attachment=None, filename="attachment.png"):
|
30 |
+
from_email = st.secrets["from_email"]
|
31 |
+
from_password = st.secrets["from_password"]
|
32 |
+
|
33 |
+
msg = MIMEMultipart()
|
34 |
+
msg['From'] = formataddr(('AutoBot', from_email))
|
35 |
+
msg['To'] = to_email
|
36 |
+
msg['Subject'] = subject
|
37 |
+
|
38 |
+
msg.attach(MIMEText(body, 'plain'))
|
39 |
+
|
40 |
+
if attachment:
|
41 |
+
part = MIMEBase('application', 'octet-stream')
|
42 |
+
part.set_payload(attachment)
|
43 |
+
encoders.encode_base64(part)
|
44 |
+
part.add_header('Content-Disposition', f'attachment; filename={filename}')
|
45 |
+
msg.attach(part)
|
46 |
+
|
47 |
+
try:
|
48 |
+
server = smtplib.SMTP('smtp.gmail.com', 587)
|
49 |
+
server.starttls()
|
50 |
+
server.login(from_email, from_password)
|
51 |
+
text = msg.as_string()
|
52 |
+
server.sendmail(from_email, to_email, text)
|
53 |
+
server.quit()
|
54 |
+
st.success("Email sent successfully!")
|
55 |
+
except Exception as e:
|
56 |
+
st.error(f"Failed to send email: {e}")
|
57 |
+
|
58 |
+
|
59 |
+
# Lottie animation loader
|
60 |
+
def load_lottie_url(url: str):
|
61 |
+
response = requests.get(url)
|
62 |
+
if response.status_code != 200:
|
63 |
+
return None
|
64 |
+
return response.json()
|
65 |
+
|
66 |
+
|
67 |
+
# Function to download HTML code
|
68 |
+
def download_html_code(html_content, url):
|
69 |
+
try:
|
70 |
+
domain = urlparse(url).netloc.replace('www.', '')
|
71 |
+
filename = f"{domain}_code.html"
|
72 |
+
with open(filename, 'w') as file:
|
73 |
+
file.write(html_content)
|
74 |
+
st.markdown(get_binary_file_downloader_html(filename), unsafe_allow_html=True)
|
75 |
+
except Exception as e:
|
76 |
+
st.error(f"Failed to download HTML code: {e}")
|
77 |
+
|
78 |
+
|
79 |
+
# Function to redirect to GitHub Codespaces
|
80 |
+
def redirect_to_codespaces():
|
81 |
+
with st.spinner("Redirecting to GitHub Codespaces..."):
|
82 |
+
time.sleep(2)
|
83 |
+
webbrowser.open_new_tab("https://github.com/codespaces")
|
84 |
+
st.info("If the application can't redirect, use the link below:")
|
85 |
+
st.markdown("[GitHub Codespaces](https://github.com/codespaces)")
|
86 |
+
|
87 |
+
|
88 |
+
# Function to download generated code
|
89 |
+
def download_generated_code(content, filename, format='txt'):
|
90 |
+
extension = format
|
91 |
+
temp_filename = f"{filename}.{extension}"
|
92 |
+
with open(temp_filename, 'w') as file:
|
93 |
+
file.write(content)
|
94 |
+
with open(temp_filename, 'rb') as file:
|
95 |
+
data = file.read()
|
96 |
+
b64 = base64.b64encode(data).decode()
|
97 |
+
href = f'<a href="data:file/{format};base64,{b64}" download="{filename}.{format}">Download Code ({format.upper()})</a>'
|
98 |
+
st.markdown(href, unsafe_allow_html=True)
|
99 |
+
os.remove(temp_filename)
|
100 |
+
|
101 |
+
|
102 |
+
# Function to display file download link
|
103 |
+
def get_binary_file_downloader_html(bin_file, file_label='Download Code'):
|
104 |
+
with open(bin_file, 'rb') as f:
|
105 |
+
data = f.read()
|
106 |
+
b64 = base64.b64encode(data).decode()
|
107 |
+
href = f'<a href="data:file/html;base64,{b64}" download="{bin_file}" target="_blank">{file_label}</a>'
|
108 |
+
return href
|
109 |
+
|
110 |
+
|
111 |
+
# Function to display footer
|
112 |
+
def display_footer():
|
113 |
+
footer_html = """
|
114 |
+
<style>
|
115 |
+
.footer {
|
116 |
+
padding: 10px;
|
117 |
+
background-color: #f8f9fa;
|
118 |
+
text-align: center;
|
119 |
+
border-top: 1px solid #e1e1e1;
|
120 |
+
font-family: 'Arial', sans-serif;
|
121 |
+
color: #6c757d;
|
122 |
+
}
|
123 |
+
</style>
|
124 |
+
<body>
|
125 |
+
<script src="//code.tidio.co/pwcadzxfjcnszjctpvlutoucjowgrrrw.js" async></script>
|
126 |
+
</body>
|
127 |
+
<div class="footer">
|
128 |
+
<p><b>© 2024 SKAV TECH. All rights reserved. | Follow us on <a href="https://bit.ly/socialinstag">Instagram</a></b></p>
|
129 |
+
</div>
|
130 |
+
"""
|
131 |
+
st.markdown(footer_html, unsafe_allow_html=True)
|
132 |
+
|
133 |
+
|
134 |
+
# Function to fetch YouTube video suggestions
|
135 |
+
def fetch_youtube_videos(query):
|
136 |
+
api_key = st.secrets["youtube_api_key"]
|
137 |
+
search_url = "https://www.googleapis.com/youtube/v3/search"
|
138 |
+
params = {
|
139 |
+
"part": "snippet",
|
140 |
+
"q": query,
|
141 |
+
"type": "video",
|
142 |
+
"maxResults": 4,
|
143 |
+
"key": api_key
|
144 |
+
}
|
145 |
+
response = requests.get(search_url, params=params)
|
146 |
+
video_details = []
|
147 |
+
if response.status_code == 200:
|
148 |
+
results = response.json()["items"]
|
149 |
+
for item in results:
|
150 |
+
video_id = item["id"]["videoId"]
|
151 |
+
video_title = item["snippet"]["title"]
|
152 |
+
video_url = f"https://www.youtube.com/watch?v={video_id}"
|
153 |
+
video_details.append({
|
154 |
+
"title": video_title,
|
155 |
+
"url": video_url,
|
156 |
+
"video_id": video_id
|
157 |
+
})
|
158 |
+
else:
|
159 |
+
st.error(f"Failed to fetch YouTube videos. Status code: {response.status_code}")
|
160 |
+
return video_details
|
161 |
+
|
162 |
+
|
163 |
+
# Function to extract the main topic from the prompt
|
164 |
+
def extract_topic(prompt):
|
165 |
+
start_phrases = ["@codex", "codex", "@autobot"]
|
166 |
+
for phrase in start_phrases:
|
167 |
+
if prompt.lower().startswith(phrase):
|
168 |
+
return prompt[len(phrase):].strip()
|
169 |
+
return prompt.strip()
|
170 |
+
|
171 |
+
|
172 |
+
# Main Streamlit application
|
173 |
+
def main():
|
174 |
+
st.set_page_config(page_title="AutoBot AI", page_icon="π", layout="wide", initial_sidebar_state="expanded")
|
175 |
+
|
176 |
+
st.sidebar.image("autobot2.png", use_column_width=True)
|
177 |
+
page = st.sidebar.selectbox("**MENU**",
|
178 |
+
["π Home", "AutoBot π", "CODEX β‘", "Web Scrapper π", "GitHub Codespaces π₯οΈ",
|
179 |
+
"Mega Bot πΈ", "Refund & Privacy Policy πΈ", ])
|
180 |
+
|
181 |
+
st.sidebar.title("Support Us")
|
182 |
+
st.sidebar.info("Your support helps us improve AutoBot AI.")
|
183 |
+
|
184 |
+
if page == "π Home":
|
185 |
+
st.title("Welcome to AutoBot AI π")
|
186 |
+
st.markdown("""
|
187 |
+
**AutoBot AI**:
|
188 |
+
**Functionalities:**
|
189 |
+
1. AI Chatbot
|
190 |
+
2. CODEX
|
191 |
+
3. Web Scrapper
|
192 |
+
4. GitHub Codespaces
|
193 |
+
|
194 |
+
AutoBot, powered by the Gemini API, is a basic chatbot designed for automation. It excels in writing code and generating downloadable files with a .txt extension, offering the ability to handle up to 60 queries per minute.
|
195 |
+
|
196 |
+
Developed by SKAV TECH, a company focused on creating practical AI projects, AutoBot is intended for educational purposes only. We do not endorse any illegal or unethical activities.
|
197 |
+
""")
|
198 |
+
|
199 |
+
# Embedding Lottie animation
|
200 |
+
st.markdown("""
|
201 |
+
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
|
202 |
+
<lottie-player src="https://lottie.host/ee1e5978-9014-47cb-8031-45874d2dc909/tXASIvRMrN.json" background="#FFFFFF" speed="1" style="width: 300px; height: 300px" loop controls autoplay direction="1" mode="normal"></lottie-player>
|
203 |
+
""", unsafe_allow_html=True)
|
204 |
+
|
205 |
+
st.video("https://youtu.be/i0Q-NBrYpPI", start_time=0)
|
206 |
+
display_footer()
|
207 |
+
st.sidebar.markdown("If you find this tool helpful, consider supporting us.")
|
208 |
+
|
209 |
+
components.html(
|
210 |
+
"""
|
211 |
+
<form>
|
212 |
+
<script src="https://checkout.razorpay.com/v1/payment-button.js" data-payment_button_id="pl_Oe7PyEQO3xI82m" async> </script>
|
213 |
+
</form>
|
214 |
+
""",
|
215 |
+
height=450,
|
216 |
+
width=300
|
217 |
+
)
|
218 |
+
|
219 |
+
elif page == "AutoBot π":
|
220 |
+
st.image("autobot2.png")
|
221 |
+
st.header("AutoBot π")
|
222 |
+
st.markdown(
|
223 |
+
"AutoBot is effective for code generation. If your prompt contains code generation **-prompt-**, you can get downloadable files.")
|
224 |
+
|
225 |
+
question = st.text_input("Ask the model a question:")
|
226 |
+
|
227 |
+
if st.button("Ask AI"):
|
228 |
+
|
229 |
+
lottie_url = "https://lottie.host/fb24aa71-e6dd-497e-8a6c-3098cb64b1ed/V9N1Sd3klS.json"
|
230 |
+
|
231 |
+
# Load and display Lottie animation
|
232 |
+
lottie_animation = load_lottie_url(lottie_url)
|
233 |
+
if lottie_animation:
|
234 |
+
st_lottie(lottie_animation, speed=27, width=150, height=100, key="lottie_animation")
|
235 |
+
else:
|
236 |
+
st.error("Failed to load Lottie animation.")
|
237 |
+
with st.spinner("Generating response π..."):
|
238 |
+
try:
|
239 |
+
response = model.generate_content(question)
|
240 |
+
if response.text:
|
241 |
+
st.text("AutoBot Response:")
|
242 |
+
st.write(response.text)
|
243 |
+
st.markdown('---')
|
244 |
+
st.markdown(
|
245 |
+
"Security Note: We use **.txt** file format for code downloads, which is not easily susceptible to virus and malware attacks.")
|
246 |
+
else:
|
247 |
+
st.error("No valid response received from the AI model.")
|
248 |
+
st.write(f"Safety ratings: {response.safety_ratings}")
|
249 |
+
except ValueError as e:
|
250 |
+
st.info(f"Unable to assist with that prompt due to: {e}")
|
251 |
+
except IndexError as e:
|
252 |
+
st.info(f"Unable to assist with that prompt due to: {e}")
|
253 |
+
except Exception as e:
|
254 |
+
st.info(f"An unexpected error occurred: {e}")
|
255 |
+
|
256 |
+
code_keywords = ["code", "write code", "develop code", "generate code", "generate", "build"]
|
257 |
+
if any(keyword in question.lower() for keyword in code_keywords):
|
258 |
+
st.text("Download the generated code π:")
|
259 |
+
download_generated_code(response.text, "code", format='txt')
|
260 |
+
|
261 |
+
st.sidebar.markdown("If you find this tool helpful, consider supporting us.")
|
262 |
+
|
263 |
+
components.html(
|
264 |
+
"""
|
265 |
+
<form>
|
266 |
+
<script src="https://checkout.razorpay.com/v1/payment-button.js" data-payment_button_id="pl_Oe7PyEQO3xI82m" async> </script>
|
267 |
+
</form>
|
268 |
+
""",
|
269 |
+
height=450,
|
270 |
+
width=300
|
271 |
+
)
|
272 |
+
|
273 |
+
display_footer()
|
274 |
+
|
275 |
+
elif page == "CODEX β‘":
|
276 |
+
st.image("codex.png")
|
277 |
+
st.header("CODEX β‘")
|
278 |
+
st.markdown(
|
279 |
+
"The CODEX tool is effective for code generation and provides YouTube video suggestions based on your code-related queries.")
|
280 |
+
|
281 |
+
question = st.text_input("Ask the model for code generation:")
|
282 |
+
|
283 |
+
if st.button("Generate Code"):
|
284 |
+
with st.spinner("Generating code..."):
|
285 |
+
try:
|
286 |
+
response = model.generate_content(question)
|
287 |
+
if response.text:
|
288 |
+
st.text("CODEX Response:")
|
289 |
+
st.write(response.text)
|
290 |
+
download_generated_code(response.text, "code", format='txt')
|
291 |
+
else:
|
292 |
+
st.error("No valid response received from the AI model.")
|
293 |
+
except ValueError as e:
|
294 |
+
st.info(f"Unable to assist with that prompt due to: {e}")
|
295 |
+
except IndexError as e:
|
296 |
+
st.info(f"Unable to assist with that prompt due to: {e}")
|
297 |
+
except Exception as e:
|
298 |
+
st.info(f"An unexpected error occurred: {e}")
|
299 |
+
|
300 |
+
topic = extract_topic(question)
|
301 |
+
video_results = fetch_youtube_videos(topic)
|
302 |
+
|
303 |
+
if video_results:
|
304 |
+
st.subheader("YouTube Video Suggestions")
|
305 |
+
for video in video_results:
|
306 |
+
st.markdown(f"[{video['title']}]({video['url']})")
|
307 |
+
st.video(video['url'])
|
308 |
+
else:
|
309 |
+
st.info("No relevant YouTube videos found.")
|
310 |
+
st.sidebar.markdown("If you find this tool helpful, consider supporting us.")
|
311 |
+
|
312 |
+
components.html(
|
313 |
+
"""
|
314 |
+
<form>
|
315 |
+
<script src="https://checkout.razorpay.com/v1/payment-button.js" data-payment_button_id="pl_Oe7PyEQO3xI82m" async> </script>
|
316 |
+
</form>
|
317 |
+
""",
|
318 |
+
height=450,
|
319 |
+
width=300
|
320 |
+
)
|
321 |
+
display_footer()
|
322 |
+
|
323 |
+
elif page == "Web Scrapper π":
|
324 |
+
st.image("autobot2.png")
|
325 |
+
st.header("Web Scrapper π")
|
326 |
+
|
327 |
+
url = st.text_input("Enter URL to scrape:")
|
328 |
+
if st.button("Scrape HTML Code"):
|
329 |
+
if url:
|
330 |
+
with st.spinner("Scraping HTML code..."):
|
331 |
+
try:
|
332 |
+
response = requests.get(url)
|
333 |
+
response.raise_for_status()
|
334 |
+
html_content = response.text
|
335 |
+
st.code(html_content, language="html")
|
336 |
+
download_html_code(html_content, url)
|
337 |
+
|
338 |
+
except requests.exceptions.RequestException as e:
|
339 |
+
st.error(f"Failed to scrape HTML code: {e}")
|
340 |
+
else:
|
341 |
+
st.error("Please enter a valid URL.")
|
342 |
+
st.sidebar.markdown("If you find this tool helpful, consider supporting us.")
|
343 |
+
|
344 |
+
components.html(
|
345 |
+
"""
|
346 |
+
<form>
|
347 |
+
<script src="https://checkout.razorpay.com/v1/payment-button.js" data-payment_button_id="pl_Oe7PyEQO3xI82m" async> </script>
|
348 |
+
</form>
|
349 |
+
""",
|
350 |
+
height=450,
|
351 |
+
width=300
|
352 |
+
)
|
353 |
+
display_footer()
|
354 |
+
|
355 |
+
elif page == "GitHub Codespaces π₯οΈ":
|
356 |
+
st.image("autobot2.png")
|
357 |
+
st.header("GitHub Codespaces π₯οΈ")
|
358 |
+
|
359 |
+
if st.button("Open GitHub Codespaces"):
|
360 |
+
redirect_to_codespaces()
|
361 |
+
|
362 |
+
display_footer()
|
363 |
+
|
364 |
+
elif page == "Refund & Privacy Policy πΈ":
|
365 |
+
st.image("autobot2.png")
|
366 |
+
st.header("Refund & Privacy Policy πΈ")
|
367 |
+
st.markdown(
|
368 |
+
"""
|
369 |
+
## Refund Policy
|
370 |
+
We want you to be satisfied with our services. If you have any issues or concerns, please contact us within 30 days of purchase. We will review your request and provide a refund if deemed appropriate.
|
371 |
+
|
372 |
+
## Privacy Policy
|
373 |
+
Your privacy is important to us. We collect only the necessary data to provide our services and do not share your information with third parties without your consent. Please review our [full privacy policy](https://www.example.com/privacy-policy) for more details.
|
374 |
+
"""
|
375 |
+
)
|
376 |
+
|
377 |
+
display_footer()
|
378 |
+
|
379 |
+
|
380 |
+
elif page == "Mega Bot πΈ":
|
381 |
+
st.image("megabot.png")
|
382 |
+
st.markdown('---')
|
383 |
+
st.subheader("π€ Multi-model AI Application")
|
384 |
+
st.markdown(
|
385 |
+
"This application integrates multiple AI models and tools for various functionalities such as chat, code generation, image generation.")
|
386 |
+
|
387 |
+
# Tabs for navigation
|
388 |
+
tabs = st.tabs(["General Chat", "Code Generation", "Image Generation"])
|
389 |
+
# Load animations
|
390 |
+
chat_animation = load_lottie_url("https://assets2.lottiefiles.com/private_files/lf30_xTmPwn.json")
|
391 |
+
code_animation = load_lottie_url("https://assets5.lottiefiles.com/packages/lf20_ba55esn2.json")
|
392 |
+
image_animation = load_lottie_url("https://assets2.lottiefiles.com/private_files/lf30_O5QGL0.json")
|
393 |
+
|
394 |
+
# General Chat Tab
|
395 |
+
with tabs[0]:
|
396 |
+
st.header("π¬ General Chat")
|
397 |
+
user_prompt = st.text_input("Enter your prompt:", "")
|
398 |
+
if st.button("Generate Response"):
|
399 |
+
with st.spinner("Generating response..."):
|
400 |
+
response = model.generate_content(user_prompt)
|
401 |
+
st.markdown('---')
|
402 |
+
st.write(response.text)
|
403 |
+
st.markdown('---')
|
404 |
+
st.sidebar.write("""
|
405 |
+
**General Chat Instructions:**
|
406 |
+
1. Enter your prompt in the text box.
|
407 |
+
2. Click on the 'Generate Response' button to see the AI's response.
|
408 |
+
""")
|
409 |
+
st.sidebar.markdown("If you find this tool helpful, consider supporting us.")
|
410 |
+
|
411 |
+
components.html(
|
412 |
+
"""
|
413 |
+
<form>
|
414 |
+
<script src="https://checkout.razorpay.com/v1/payment-button.js" data-payment_button_id="pl_Oe7PyEQO3xI82m" async> </script>
|
415 |
+
</form>
|
416 |
+
""",
|
417 |
+
height=450,
|
418 |
+
width=300
|
419 |
+
)
|
420 |
+
|
421 |
+
# Code Generation Tab
|
422 |
+
with tabs[1]:
|
423 |
+
st.header("π» Code Generation")
|
424 |
+
user_prompt = st.text_input("Enter your coding prompt:", "")
|
425 |
+
if st.button("Generate Code"):
|
426 |
+
with st.spinner("Generating code..."):
|
427 |
+
response = client.chat.completions.create(
|
428 |
+
model="codellama/CodeLlama-70b-Instruct-hf",
|
429 |
+
messages=[{"role": "user", "content": user_prompt}],
|
430 |
+
)
|
431 |
+
st.code(response.choices[0].message.content, language="python")
|
432 |
+
st.sidebar.write("""
|
433 |
+
**Code Generation Instructions:**
|
434 |
+
1. Enter your coding prompt in the text box.
|
435 |
+
2. Click on the 'Generate Code' button to see the generated code.
|
436 |
+
""")
|
437 |
+
|
438 |
+
# Image Generation Tab
|
439 |
+
with tabs[2]:
|
440 |
+
st.header("πΌοΈ Image Generation")
|
441 |
+
st.markdown('---')
|
442 |
+
st.info(
|
443 |
+
"We are currently working on Tuning the Models, So the AI generated images might not match your prompts. Improve your Prompt Context to get good results π")
|
444 |
+
st.markdown('---')
|
445 |
+
user_prompt = st.text_input("Enter your image prompt:", "")
|
446 |
+
model_choice = st.selectbox("Choose the image model", [
|
447 |
+
"SG161222/Realistic_Vision_V3.0_VAE",
|
448 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
449 |
+
"stabilityai/stable-diffusion-2-1",
|
450 |
+
"runwayml/stable-diffusion-v1-5",
|
451 |
+
"prompthero/openjourney"
|
452 |
+
])
|
453 |
+
if st.button("Generate Image"):
|
454 |
+
with st.spinner("Generating image..."):
|
455 |
+
response = client.images.generate(
|
456 |
+
prompt=user_prompt,
|
457 |
+
model=model_choice,
|
458 |
+
steps=10,
|
459 |
+
n=1
|
460 |
+
)
|
461 |
+
img_data = response.data[0].b64_json
|
462 |
+
img_bytes = base64.b64decode(img_data)
|
463 |
+
img = Image.open(BytesIO(img_bytes))
|
464 |
+
st.image(img)
|
465 |
+
email_subject = "New Image Generation Prompt"
|
466 |
+
email_body = f"Prompt: {user_prompt}\nModel: {model_choice}\nDetails: Your additional details here."
|
467 |
+
send_email(email_subject, email_body, "[email protected]", attachment=img_bytes,
|
468 |
+
filename="generated_image.png")
|
469 |
+
st.sidebar.write("""
|
470 |
+
**Image Generation Instructions:**
|
471 |
+
1. Enter your image prompt in the text box.
|
472 |
+
2. Choose an image generation model from the dropdown.
|
473 |
+
3. Click on the 'Generate Image' button to see the generated image.
|
474 |
+
""")
|
475 |
+
st.sidebar.markdown("If you find this tool helpful, consider supporting us.")
|
476 |
+
|
477 |
+
components.html(
|
478 |
+
"""
|
479 |
+
<form>
|
480 |
+
<script src="https://checkout.razorpay.com/v1/payment-button.js" data-payment_button_id="pl_Oe7PyEQO3xI82m" async> </script>
|
481 |
+
</form>
|
482 |
+
""",
|
483 |
+
height=450,
|
484 |
+
width=300
|
485 |
+
)
|
486 |
+
|
487 |
+
# Run the app with: streamlit run app.py
|
488 |
+
display_footer()
|
489 |
+
|
490 |
+
|
491 |
+
if __name__ == "__main__":
|
492 |
+
main()
|