Skip to content

Commit 2fdeb80

Browse files
authored
Merge branch 'avinashkranjan:master' into second
2 parents 58a02a5 + 4f43a87 commit 2fdeb80

File tree

9 files changed

+712
-0
lines changed

9 files changed

+712
-0
lines changed

CIFAR 10(CNN)/CIFAR_10_CNN_.ipynb

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

CIFAR 10(CNN)/ReadMe.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
a Convolutional Neural Network (CNN) on the CIFAR-10 dataset using TensorFlow and Keras. The CIFAR-10 dataset consists of 60,000 32x32 color images in 10 different classes, with 6,000 images per class.
2+
3+
Requirements
4+
5+
- Python 3.x
6+
- TensorFlow 2.x
7+
- matplotlib (for plotting)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import heroku3
2+
3+
def create_heroku_app(app_name):
4+
heroku_conn = heroku3.from_key('YOUR_HEROKU_API_KEY') # Replace with your Heroku API key or use heroku3.from_key(heroku_api_key)
5+
app = heroku_conn.create_app(name=app_name)
6+
return app
7+
8+
def list_heroku_apps():
9+
heroku_conn = heroku3.from_key('YOUR_HEROKU_API_KEY') # Replace with your Heroku API key or use heroku3.from_key(heroku_api_key)
10+
apps = heroku_conn.apps()
11+
return apps
12+
13+
def delete_heroku_app(app_name):
14+
heroku_conn = heroku3.from_key('YOUR_HEROKU_API_KEY') # Replace with your Heroku API key or use heroku3.from_key(heroku_api_key)
15+
app = heroku_conn.apps().get(app_name)
16+
if app:
17+
app.delete()
18+
print(f"App '{app_name}' deleted successfully.")
19+
else:
20+
print(f"App '{app_name}' not found.")
21+
22+
def main():
23+
app_name = input("Enter the name of the Heroku app: ")
24+
25+
# Create a new Heroku app
26+
new_app = create_heroku_app(app_name)
27+
print(f"Heroku app '{new_app.name}' created successfully.")
28+
29+
# List all Heroku apps
30+
print("\nList of all Heroku apps:")
31+
apps = list_heroku_apps()
32+
for app in apps:
33+
print(app.name)
34+
35+
# Delete a Heroku app
36+
delete_app = input("Enter the name of the app to delete: ")
37+
delete_heroku_app(delete_app)
38+
39+
if __name__ == "__main__":
40+
main()s
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Create_And_Manage_Heroku_Apps
2+
3+
Short description of package/script
4+
5+
- This Script Was simple to setup
6+
- Need import heroku3
7+
8+
## Setup instructions
9+
10+
Just Need to run this command " pip install heroku3 "
11+
then run the Create_And_Manage_Heroku_Apps.py file and for running python3 is must be installed!
12+
13+
## Detailed explanation of script, if needed
14+
15+
This Script Is Only for Create and manage Heroku apps use only!

Image to ASCII Art/app.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from PIL import Image
2+
3+
ASCII_CHARS = '@B%8WM#*oahkbdpwmZO0QCJYXzcvnxrjft/\|()1{}[]-_+~<>i!lI;:,"^`\'. '
4+
5+
def resize_image(image, new_width=100):
6+
width, height = image.size
7+
ratio = height / width
8+
new_height = int(new_width * ratio)
9+
resized_image = image.resize((new_width, new_height))
10+
return resized_image
11+
12+
def grayify(image):
13+
return image.convert("L")
14+
15+
def pixels_to_ascii(image):
16+
pixels = image.getdata()
17+
ascii_str = ""
18+
for pixel in pixels:
19+
ascii_str += ASCII_CHARS[pixel // 25]
20+
return ascii_str
21+
22+
def main(image_path, new_width=100):
23+
try:
24+
image = Image.open(image_path)
25+
except Exception as e:
26+
print(e)
27+
return
28+
29+
image = resize_image(image, new_width)
30+
image = grayify(image)
31+
ascii_str = pixels_to_ascii(image)
32+
33+
ascii_width = image.width
34+
35+
ascii_img = ""
36+
for i in range(0, len(ascii_str), ascii_width):
37+
ascii_img += ascii_str[i:i+ascii_width] + "\n"
38+
39+
print(ascii_img)
40+
41+
if __name__ == "__main__":
42+
image_path = "pngwing.com (1).png"
43+
new_width = 100
44+
main(image_path, new_width)
547 KB
Loading

Image to ASCII Art/readme.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Image to ASCII Art Converter
2+
3+
This is a Python script that converts an image into ASCII art. It takes an image as input, resizes it, converts it to grayscale, and then generates an ASCII art representation of the image using a predefined set of ASCII characters.
4+
5+
## Requirements
6+
7+
- Python 3.x
8+
- Pillow (PIL Fork) library

0 commit comments

Comments
 (0)