chaitanya1 commited on
Commit
6ed23ea
·
verified ·
1 Parent(s): 56d02bd
app.py ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Created Date: 09-26-2024
3
+ Updated Date: -
4
+ Author: Chaitanya Chadha
5
+ """
6
+
7
+ import streamlit as st
8
+ from transformers import AutoImageProcessor, ResNetForImageClassification
9
+ import torch
10
+ from PIL import Image, ImageDraw, ImageFont
11
+ import math
12
+ import os
13
+ import io
14
+ from datetime import datetime
15
+
16
+ # Set page configuration at the very beginning
17
+ st.set_page_config(page_title="🎨 Colored ASCII Art Generator", layout="wide")
18
+
19
+ # Initialize model and processor once to improve performance
20
+ @st.cache_resource
21
+ def load_model_and_processor():
22
+ processor = AutoImageProcessor.from_pretrained("microsoft/resnet-50")
23
+ model = ResNetForImageClassification.from_pretrained("microsoft/resnet-50")
24
+ return processor, model
25
+
26
+ processor, model = load_model_and_processor()
27
+
28
+ def Classify_Image(image):
29
+ """
30
+ Classifies the image using a pre-trained ResNet-50 model.
31
+ Returns the predicted label.
32
+ """
33
+ inputs = processor(image, return_tensors="pt")
34
+ with torch.no_grad():
35
+ logits = model(**inputs).logits
36
+ # model predicts one of the 1000 ImageNet classes
37
+ predicted_label = logits.argmax(-1).item()
38
+ return model.config.id2label[predicted_label]
39
+
40
+ def resize_image(image, new_width=100):
41
+ width, height = image.size
42
+ aspect_ratio = height / width
43
+ # Adjusting height based on the aspect ratio and a scaling factor
44
+ new_height = int(aspect_ratio * new_width * 0.55)
45
+ resized_image = image.resize((new_width, new_height))
46
+ return resized_image
47
+
48
+ def grayify(image):
49
+ return image.convert("L")
50
+
51
+ def calculate_image_entropy(image):
52
+ # Calculates the entropy of the grayscale image to determine its complexity.
53
+ # Higher entropy indicates a more complex image with more details.
54
+ histogram = image.histogram()
55
+ histogram_length = sum(histogram)
56
+
57
+ samples_probability = [float(h) / histogram_length for h in histogram if h != 0]
58
+ entropy = -sum([p * math.log(p, 2) for p in samples_probability])
59
+
60
+ return entropy
61
+
62
+ def select_character_set(entropy, art_gen_choice, classification):
63
+ ASCII_CHARS_SETS = {
64
+ "standard": [
65
+ '@', '%', '#', '*', '+', '=', '-', ':', '.', ' '
66
+ ],
67
+ "detailed": [
68
+ '$', '@', 'B', '%', '8', '&', 'W', 'M', '#', '*', 'o', 'a', 'h', 'k', 'b',
69
+ 'd', 'p', 'q', 'w', 'm', 'Z', 'O', '0', 'Q', 'L', 'C', 'J', 'U', 'Y',
70
+ 'X', 'z', 'c', 'v', 'u', 'n', 'x', 'r', 'j', 'f', 't', '/', '\\', '|',
71
+ '(', ')', '1', '{', '}', '[', ']', '?', '-', '_', '+', '~', '<', '>',
72
+ 'i', '!', 'l', 'I', ';', ':', ',', '"', '^', '', "'", '.', ' '
73
+ ],
74
+ "simple": [
75
+ '#', '*', '+', '=', '-', ':', '.', ' '
76
+ ],
77
+ "custom": [
78
+ "!", "~", "@", "#", "$", "%", "¨", "&", "*", "(", ")", "_", "+", "-",
79
+ "=", "{", "}", "[", "]", "|", "\\", "/", ":", ";", "'", "\"", ",", "<",
80
+ ".", ">", "?", " " ] + list(set(list(str(classification))))
81
+ }
82
+
83
+ if art_gen_choice.lower() == "custom":
84
+ selected_set = "custom"
85
+ return ASCII_CHARS_SETS[selected_set]
86
+ else:
87
+ # Define entropy thresholds (these values can be adjusted based on experimentation)
88
+ if entropy < 4.0:
89
+ selected_set = "simple"
90
+ elif 4.0 <= entropy < 5.5:
91
+ selected_set = "standard"
92
+ else:
93
+ selected_set = "detailed"
94
+
95
+ return ASCII_CHARS_SETS[selected_set]
96
+
97
+ def determine_optimal_width(image, max_width=120):
98
+ # Determines the optimal width for the ASCII art based on the image's original dimensions.
99
+ original_width, original_height = image.size
100
+ if original_width > max_width:
101
+ return max_width
102
+ else:
103
+ return original_width
104
+
105
+ def render_ascii_to_image(ascii_chars, img_width, img_height, font_path="fonts/DejaVuSansMono.ttf", font_size=10):
106
+ # Renders the ASCII characters onto an image with their corresponding colors.
107
+ if not os.path.isfile(font_path):
108
+ st.error(f"Font file not found at {font_path}. Please provide a valid font path.")
109
+ return None
110
+
111
+ # Create a new image with white background
112
+ try:
113
+ font = ImageFont.truetype(font_path, font_size)
114
+ except Exception as e:
115
+ st.error(f"Error loading font: {e}")
116
+ return None
117
+
118
+ # Get character dimensions
119
+ # Using getbbox which is compatible with Pillow >= 8.0
120
+ left, top, right, bottom = font.getbbox('A')
121
+ char_width = right - left
122
+ char_height = bottom - top
123
+ image_width = char_width * img_width
124
+ image_height = char_height * img_height
125
+ new_image = Image.new("RGB", (image_width, image_height), "white")
126
+ draw = ImageDraw.Draw(new_image)
127
+
128
+ for i, (char, color) in enumerate(ascii_chars):
129
+ x = (i % img_width) * char_width
130
+ y = (i // img_width) * char_height
131
+ draw.text((x, y), char, fill=color, font=font)
132
+
133
+ return new_image
134
+
135
+ def pixels_to_colored_ascii(grayscale_image, color_image, chars):
136
+ # Maps each pixel to an ASCII character from the selected character set.
137
+ # Returns a list of tuples: (character, (R, G, B))
138
+ grayscale_pixels = grayscale_image.getdata()
139
+ color_pixels = color_image.getdata()
140
+ ascii_chars = []
141
+
142
+ for grayscale_pixel, color_pixel in zip(grayscale_pixels, color_pixels):
143
+ # Scale grayscale pixel value to the range of the character set
144
+ index = grayscale_pixel * (len(chars) - 1) // 255
145
+ ascii_char = chars[index]
146
+
147
+ # Extract RGB values; ignore alpha if present
148
+ if len(color_pixel) == 4:
149
+ r, g, b, _ = color_pixel
150
+ else:
151
+ r, g, b = color_pixel
152
+
153
+ ascii_chars.append((ascii_char, (r, g, b)))
154
+
155
+ return ascii_chars
156
+
157
+ def generate_ascii_art(image, font_path="fonts/DejaVuSansMono.ttf", font_size=12):
158
+ # image: PIL Image object
159
+
160
+ # Classify the image
161
+ image_class = Classify_Image(image)
162
+ st.write(f"**Image Classification:** {image_class}")
163
+
164
+ # Convert to grayscale and calculate entropy
165
+ grayscale_image = grayify(image)
166
+ entropy = calculate_image_entropy(grayscale_image)
167
+ st.write(f"**Image Entropy:** {entropy:.2f}")
168
+
169
+ # Select character set
170
+ art_gen_choice = st.session_state.get('art_gen_choice', 'custom')
171
+ selected_chars = select_character_set(entropy, art_gen_choice, image_class)
172
+ st.write(f"**Selected Character Set:** '{art_gen_choice}' with {len(selected_chars)} characters.")
173
+
174
+ # Determine optimal width
175
+ optimal_width = determine_optimal_width(image)
176
+ st.write(f"**Selected Width:** {optimal_width}")
177
+
178
+ # Resize images
179
+ resized_image = resize_image(image, optimal_width)
180
+ grayscale_resized_image = grayify(resized_image)
181
+ color_resized_image = resized_image.convert("RGB") # Ensure image is in RGB mode
182
+
183
+ # Convert pixels to ASCII
184
+ ascii_chars = pixels_to_colored_ascii(grayscale_resized_image, color_resized_image, selected_chars)
185
+
186
+ # Create ASCII string
187
+ ascii_str = ''.join([char for char, color in ascii_chars])
188
+ ascii_lines = [ascii_str[index: index + optimal_width] for index in range(0, len(ascii_str), optimal_width)]
189
+ ascii_art = "\n".join(ascii_lines)
190
+
191
+ return ascii_art, ascii_chars, resized_image.size
192
+
193
+ def main():
194
+ # Title and Description are already set after set_page_config
195
+ st.title("🎨 Colored ASCII Art Generator")
196
+
197
+ st.markdown("""
198
+ Upload an image, and this app will convert it into colored ASCII art.
199
+ You can view the classification, entropy, and download or copy the ASCII art.
200
+ """)
201
+
202
+ # Sidebar for options
203
+ st.sidebar.header("Options")
204
+ art_gen_choice = st.sidebar.selectbox(
205
+ "Character Set Choice",
206
+ options=["custom", "standard", "detailed", "simple"],
207
+ help="Select the character set to use for ASCII art generation."
208
+ )
209
+ st.session_state['art_gen_choice'] = art_gen_choice
210
+
211
+ # File uploader
212
+ uploaded_file = st.file_uploader("Upload an Image", type=["png", "jpg", "jpeg", "bmp", "gif"])
213
+
214
+ if uploaded_file is not None:
215
+ try:
216
+ # Read the image
217
+ image = Image.open(uploaded_file).convert("RGB")
218
+ st.image(image, caption='Uploaded Image', use_column_width=True)
219
+
220
+ # Generate ASCII Art
221
+ with st.spinner("Generating ASCII Art..."):
222
+ ascii_art, ascii_chars, resized_size = generate_ascii_art(image)
223
+
224
+ # Display ASCII Art as Image
225
+ ascii_image = render_ascii_to_image(
226
+ ascii_chars,
227
+ img_width=resized_size[0],
228
+ img_height=resized_size[1],
229
+ font_path="fonts/DejaVuSansMono.ttf",
230
+ font_size=12
231
+ )
232
+
233
+ if ascii_image:
234
+ st.image(ascii_image, caption='Colored ASCII Art', use_column_width=True)
235
+
236
+ # Provide Download Button for ASCII Image
237
+ img_byte_arr = io.BytesIO()
238
+ ascii_image.save(img_byte_arr, format='PNG')
239
+ img_byte_arr = img_byte_arr.getvalue()
240
+
241
+ st.download_button(
242
+ label="📥 Download ASCII Art Image",
243
+ data=img_byte_arr,
244
+ file_name=f"ascii_art_{datetime.now().strftime('%Y%m%d_%H%M%S')}.png",
245
+ mime="image/png"
246
+ )
247
+
248
+ # Display ASCII Art as Text with Copy Option
249
+ st.text_area("ASCII Art", ascii_art, height=300)
250
+
251
+ # Provide a download button for the ASCII text
252
+ st.download_button(
253
+ label="📄 Download ASCII Art Text",
254
+ data=ascii_art,
255
+ file_name=f"ascii_art_{datetime.now().strftime('%Y%m%d_%H%M%S')}.txt",
256
+ mime="text/plain"
257
+ )
258
+
259
+ except Exception as e:
260
+ st.error(f"An error occurred: {e}")
261
+ else:
262
+ st.info("Please upload an image to get started.")
263
+
264
+ if __name__ == "__main__":
265
+ main()
fonts/DejaVu Fonts License.txt ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
2
+ Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
3
+
4
+ Bitstream Vera Fonts Copyright
5
+ ------------------------------
6
+
7
+ Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
8
+ a trademark of Bitstream, Inc.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of the fonts accompanying this license ("Fonts") and associated
12
+ documentation files (the "Font Software"), to reproduce and distribute the
13
+ Font Software, including without limitation the rights to use, copy, merge,
14
+ publish, distribute, and/or sell copies of the Font Software, and to permit
15
+ persons to whom the Font Software is furnished to do so, subject to the
16
+ following conditions:
17
+
18
+ The above copyright and trademark notices and this permission notice shall
19
+ be included in all copies of one or more of the Font Software typefaces.
20
+
21
+ The Font Software may be modified, altered, or added to, and in particular
22
+ the designs of glyphs or characters in the Fonts may be modified and
23
+ additional glyphs or characters may be added to the Fonts, only if the fonts
24
+ are renamed to names not containing either the words "Bitstream" or the word
25
+ "Vera".
26
+
27
+ This License becomes null and void to the extent applicable to Fonts or Font
28
+ Software that has been modified and is distributed under the "Bitstream
29
+ Vera" names.
30
+
31
+ The Font Software may be sold as part of a larger software package but no
32
+ copy of one or more of the Font Software typefaces may be sold by itself.
33
+
34
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
35
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
36
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
37
+ TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
38
+ FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
39
+ ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
40
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
41
+ THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
42
+ FONT SOFTWARE.
43
+
44
+ Except as contained in this notice, the names of Gnome, the Gnome
45
+ Foundation, and Bitstream Inc., shall not be used in advertising or
46
+ otherwise to promote the sale, use or other dealings in this Font Software
47
+ without prior written authorization from the Gnome Foundation or Bitstream
48
+ Inc., respectively. For further information, contact: fonts at gnome dot
49
+ org.
50
+
51
+ Arev Fonts Copyright
52
+ ------------------------------
53
+
54
+ Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
55
+
56
+ Permission is hereby granted, free of charge, to any person obtaining
57
+ a copy of the fonts accompanying this license ("Fonts") and
58
+ associated documentation files (the "Font Software"), to reproduce
59
+ and distribute the modifications to the Bitstream Vera Font Software,
60
+ including without limitation the rights to use, copy, merge, publish,
61
+ distribute, and/or sell copies of the Font Software, and to permit
62
+ persons to whom the Font Software is furnished to do so, subject to
63
+ the following conditions:
64
+
65
+ The above copyright and trademark notices and this permission notice
66
+ shall be included in all copies of one or more of the Font Software
67
+ typefaces.
68
+
69
+ The Font Software may be modified, altered, or added to, and in
70
+ particular the designs of glyphs or characters in the Fonts may be
71
+ modified and additional glyphs or characters may be added to the
72
+ Fonts, only if the fonts are renamed to names not containing either
73
+ the words "Tavmjong Bah" or the word "Arev".
74
+
75
+ This License becomes null and void to the extent applicable to Fonts
76
+ or Font Software that has been modified and is distributed under the
77
+ "Tavmjong Bah Arev" names.
78
+
79
+ The Font Software may be sold as part of a larger software package but
80
+ no copy of one or more of the Font Software typefaces may be sold by
81
+ itself.
82
+
83
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
84
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
85
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
86
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
87
+ TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
88
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
89
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
90
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
91
+ OTHER DEALINGS IN THE FONT SOFTWARE.
92
+
93
+ Except as contained in this notice, the name of Tavmjong Bah shall not
94
+ be used in advertising or otherwise to promote the sale, use or other
95
+ dealings in this Font Software without prior written authorization
96
+ from Tavmjong Bah. For further information, contact: tavmjong @ free
97
+ . fr.
fonts/DejaVuSansMono-Bold.ttf ADDED
Binary file (318 kB). View file
 
fonts/DejaVuSansMono-BoldOblique.ttf ADDED
Binary file (240 kB). View file
 
fonts/DejaVuSansMono-Oblique.ttf ADDED
Binary file (246 kB). View file
 
fonts/DejaVuSansMono.ttf ADDED
Binary file (335 kB). View file
 
images/.DS_Store ADDED
Binary file (6.15 kB). View file
 
images/ball.jpg ADDED
images/bean.png ADDED
output/ascii_art.txt ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cccccccccccccccccccccccccccccccccccccccccccccar ?.<"';:://\\\\\//:;'",.> raccccccccccccccccccccccccccccccccccccccccccccc
2
+ cccccccccccccccccccccccccccccccccccccccam?.,;/\|][[[}}}}}}{{{{{{{{}}}}}[]|\:"<?maccccccccccccccccccccccccccccccccccccccc
3
+ ccccccccccccccccccccccccccccccccccar <'/|][}}}{{{{{{{======================{{{}]\;<?rccccccccccccccccccccccccccccccccccc
4
+ ccccccccccccccccccccccccccccccca <;\][}}}{{{{{{{=================================={}]:,?accccccccccccccccccccccccccccccc
5
+ ccccccccccccccccccccccccccccr?"/][}}}{{{{=================-------------------------====}];.rcccccccccccccccccccccccccccc
6
+ ccccccccccccccccccccccccca?"/][}}{{{{{{===============-----------------------------++--{[]|;< accccccccccccccccccccccccc
7
+ cccccccccccccccccccccccr.:][}}{{{{{{==============------------------------------++-}\;',,,,""",?rccccccccccccccccccccccc
8
+ cccccccccccccccccccccr./[[}}{{{{{{============------------------------------+++=]:,<.<<<,,,"""''".mccccccccccccccccccccc
9
+ cccccccccccccccccccr./[}}}{{{{{=============---------------------------+++++-[;<..<<<<<<,,,"""''';'< ccccccccccccccccccc
10
+ ccccccccccccccccca?:[}}}{{{{{{=============--------------------------+++++{/,....<<<<<<<,,,""""''';;;,mccccccccccccccccc
11
+ cccccccccccccccam<|}}}{{{{{{==============--------------------------+++-[;.>.....<<<<<<<,,,""""''';;;:;<rccccccccccccccc
12
+ cccccccccccccar?'[}}{{{{{{{=============---------------------------++-]">>.......<<<<<<<,,,,"""''';;:::/;?accccccccccccc
13
+ cccccccccccca >/}}}{{{{================--------------------------++-|,>>.........<<<<<<,,,,""""''';;;::///"rcccccccccccc
14
+ cccccccccccr ?\}}}{{{{{{==============-------------------------++-\<>>...........<<<<<<,,,,""""''';;:::///\:?ccccccccccc
15
+ cccccccccam ?\{}{{{{{{================-----------------------++-|,>>............<<<<<<<,,,,""""''';;::://\\\\.accccccccc
16
+ ccccccccam \{}{{{{{=================---===========---------++],>>..............<<<<<<,,,,,""""''';;:://\\||||,acccccccc
17
+ cccccccam m:{{{{{{{======================{}[[]]][[}{==-----+}'>>...............<<<<<<<,,,,"""""''';;:://\\|||||'accccccc
18
+ ccccccam m<{{{{{{{===================={}]/;',,<,"':\[}==-+=:>>>...............<<<<<<<,,,,,""""''';;;:://\\||]]]]'acccccc
19
+ cccccam m [{{{{{{==================={}|:,.? mmrmm ><'\[{=\<>>>...............<<<<<<<,,,,,"""""''';;::://\\|]]][[['accccc
20
+ cccccm mm/{{{{{{==================={}\'. mraaaaaarr >"/|">>>>................<<<<<<<,,,,,""""''';;;:://\\||]][[[[[,ccccc
21
+ ccccr mm>{{{{{{{===================}|;. raaaaaaaaarr <">>>>>>...............<<<<<<<,,,,,"""""''';;;:://\\||]][[}}[]>cccc
22
+ ccca mr:{{{{{{==================={[/">mraaaaaaaaaar?.>>>>>................<<<<<<<,,,,,,""""''';;;::://\\|]][[}}}}}\mccc
23
+ ccam mm [{{{{{===================={[\">mraaaaaaaaam?>>>>>................<<<<<<<<,,,,,"""""'''';;;:://\\||]][}}}{{}['ccc
24
+ ccr mr"={{{{======================{]:,>mrraaaaar ?>>>>>................<<<<<<<<,,,,,,""""'''';;;:://\\\|]][[}}{=={}]?cc
25
+ ca mmr\={{{=================---====}]:".? mrrrm?>>>>>>................<<<<<<<<,,,,,,""""'''';;;::://\\||]][}}{{==={}/ac
26
+ cr mmm[{{{=================------==={[|/'"<.<<.>>>>>.................<<<<<<<<<,,,,,""""''''';;::://\\||]][[}}{===={}{?c
27
+ c mm?}{{{==================-------==={}[]||:.>>>..................<<<<<<<<,,,,,,,""""''''';;;:://\\\|]][[[}{======{-;c
28
+ a mr.={{===================-----------====/.>>..................<<<<<<<<<,,,,,,,""""''''';;;::///\\||]][[}{{==--==-+[r
29
+ r? mr<={{{==============----------------+='>>..................<<<<<<<<<<,,,,,,"""""''''';;;::///\\||]][[}}{==----=_+{>
30
+ m? mr<={{===============---------------+}<>....................<<<<<<<<<,,,,,,"""""''''';;;::://\\||]][[}}{{=-----_)_="
31
+ ? mr<={{================-------------+].>..................<<<<<<<<<<,,,,,,,"""""'''';;;;::://\\||]][[}}{{=--+--+()_-:
32
+ mr<={===============---------------/>>.................<<<<<<<<<<,,,,,,,""""""'''';;;;::///\\||]][[}}{{==--+-+**)_-\
33
+ ? mr>{{==============---------------;>..................<<<<<<<<<,,,,,,,,"""""''''';;;:::///\\|||][[[}}{==--+-+**((_-|
34
+ mmm[===============-------------='>................<<<<<<<<<<,,,,,,,,"""""''''';;;;:::///\\||]][[[}}{==--+-_*&*((_-]
35
+ ? mmr|=============-------------+=">...............<<<<<<<<<<,,,,,,,,""""""''''';;;;:::///\\||]][[[}}{==----)&&&*()_-|
36
+ ? mmr;=============------------+{,>.............<<<<<<<<<<<,,,,,,,,,"""""''''';;;;:::///\\\||]][[[}}{==---+(&&&**()_-:
37
+ m? mmr>{============-----------+}<>............<<<<<<<<<<<<,,,,,,,,"""""'''''';;;;:::///\\\||]][[}}{{{=---_*&&&&**()_-"
38
+ r? mmr|============----------+}<>..........<<<<<<<<<<<<,,,,,,,,,""""""''''';;;;::::///\\|||]][[}}}{{==-+(&&&&&***()_=>
39
+ a?? mmr,===========----------+}<..........<<<<<<<<<<<<,,,,,,,,,""""""''''';;;;;:::///\\\||]]][[}}{{===-)&&&&&&&**((_+[r
40
+ c ? mmmm[==========---------+{<........<<<<<<<<<<<<<,,,,,,,,,"""""''''''';;;::::////\\|||]][[[}}{{==-_*&&&&&&&**(()_+:c
41
+ cr? mmr,==========---------=,.......<<<<<<<<<<<<<,,,,,,,,,""""""'''''';;;;::::///\\\||]]][[[}}{{==_*&&&&&&&&&**())_-?c
42
+ ca ? mmmm|========---------=".....<<<<<<<<<<<<<,,,,,,,,,""""""''''''';;;;::::///\\\|||]]][[}}{{{=_*&&&&&&&&&&**(()__\ac
43
+ ccr? mmr>{=======---------'....<<<<<<<<<<<<<<,,,,,,,,""""""'''''';;;;;::::////\\\||]]][[[}}}{-)*&&&&&&&&&&&***())_->cc
44
+ cca ? mmr'-=====--------+/.<<<<<<<<<<<<<<<,,,,,,,,,""""""'''''';;;;;::::////\\\|||]]][[[}}{+(&&&&&&&&&&&&&***(()__/ccc
45
+ ccca?? mmm\-====-------+|.<<<<<<<<<<<<<,,,,,,,,,"""""""''''''';;;;::::////\\\|||]]][[[[}=_*&&&&&&&&&&&&&****(())_{mccc
46
+ ccccr?? mmm ]-===-------{<<<<<<<<<<<<,,,,,,,,,""""""""'''''';;;;;:::://///\\\|||]][[[}{+(&&&&&&&&&&&&&&*****(())_+.cccc
47
+ cccccm? m?[-==-------'.<<<<<<<<,,,,,,,,,,"""""""''''''';;;;;::::////\\\\||]]]][[{+)*&&&&&&&&&&&&&&&*****(())__'ccccc
48
+ ccccca ? m?[-=-----+\.<<<<<,,,,,,,,,,,""""""""'''''';;;;;;::::////\\\\||||]][=_(********&&&&&&*********(())__/accccc
49
+ cccccca>> m?]------{,<<<,,,,,,,,,,,""""""""''''''';;;;;:::://///\\\\|||][{-_(**************&&&*******((())_)\acccccc
50
+ ccccccca.,> ;+__+-+:<,,,,,,,,,,,"""""""""'''''''';;;;:::://///\\\\||]}-_(***************************((())))\accccccc
51
+ cccccccca.:;<?m>-++__--['<,,,,,,""""""""""''''''';;;;;::::://////\\][{-_)(***(***********************((((()))_:acccccccc
52
+ cccccccccc?/]]/'{--+___()[",,""""""""""'''''''';;;;;::::::///\|[{=+)((((((((***********************((((())))+"cccccccccc
53
+ cccccccccccm'|}{{-=-+___)*+',""""""""'''''''''';;;;:://\][}=+_))(((((((((((((*******************((((((()))){>ccccccccccc
54
+ cccccccccccca<\[}===-+___)&_/;;;''''';;;;;:://\|][}{=-+__)))))))))(((((((((((((((**((*******((((((((())))_\rcccccccccccc
55
+ cccccccccccccc ;|[{==-+___(&_{{{{{{{{{{===---++++________))))))))(((((((((((((((((((((((((((((((((()))))=<cccccccccccccc
56
+ ccccccccccccccca./]}{==-+_)(+{{======-----++++++++______))))))))))()((((((((((((((((((((((((((()))))))+:rccccccccccccccc
57
+ cccccccccccccccccr<\[}][}{=={{{{====-----+++++++_______))))))))))))))))(((((((((((((((((()))))))))))_\ ccccccccccccccccc
58
+ cccccccccccccccccccm,\||]][[}}{{====-----++++++__________)))))))))))))))))))()))))))))))))))))))))+|?ccccccccccccccccccc
59
+ cccccccccccccccccccccm<:\|]][[}{{=====----++++++++__________)))))))))))))))))))))))))))))))))_))-/?ccccccccccccccccccccc
60
+ cccccccccccccccccccccccr>'/||][[[}{{=====------+++++____________)))))))))))))))))))))))____))_}'mccccccccccccccccccccccc
61
+ cccccccccccccccccccccccccam<;\|]]][[}{{=====------++++++++______________________________))_=/>accccccccccccccccccccccccc
62
+ cccccccccccccccccccccccccccca <;/|]]][[}{{{======------++++++++++_____________________)_{/.rcccccccccccccccccccccccccccc
63
+ cccccccccccccccccccccccccccccccam>":\|]][[}}{{{=======------++++++++++++++++++++___+=]'?accccccccccccccccccccccccccccccc
64
+ ccccccccccccccccccccccccccccccccccca .":\|][[[}}}{{{========------------++++__+-}\">rccccccccccccccccccccccccccccccccccc
65
+ cccccccccccccccccccccccccccccccccccccccar .,':\|][[}}{{{{======---------={[|:">maccccccccccccccccccccccccccccccccccccccc
66
+ cccccccccccccccccccccccccccccccccccccccccccccarm?><"';//\||]]]]]||\/;"<> maccccccccccccccccccccccccccccccccccccccccccccc
output/ball_ascii.png ADDED
output/ball_ascii.txt ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cccccccccccccccccccccccccccccccccccccccccccccrm ?.<"';:://\\\\\//:;'",.> mrccccccccccccccccccccccccccccccccccccccccccccc
2
+ cccccccccccccccccccccccccccccccccccccccra?.,;/\|][[[}}}}}}{{{{{{{{}}}}}[]|\:"<?arccccccccccccccccccccccccccccccccccccccc
3
+ ccccccccccccccccccccccccccccccccccrm <'/|][}}}{{{{{{{======================{{{}]\;<?mccccccccccccccccccccccccccccccccccc
4
+ cccccccccccccccccccccccccccccccr <;\][}}}{{{{{{{=================================={}]:,?rccccccccccccccccccccccccccccccc
5
+ ccccccccccccccccccccccccccccm?"/][}}}{{{{=================-------------------------====}];.mcccccccccccccccccccccccccccc
6
+ cccccccccccccccccccccccccr?"/][}}{{{{{{===============-----------------------------++--{[]|;< rccccccccccccccccccccccccc
7
+ cccccccccccccccccccccccm.:][}}{{{{{{==============------------------------------++-}\;',,,,""",?mccccccccccccccccccccccc
8
+ cccccccccccccccccccccm./[[}}{{{{{{============------------------------------+++=]:,<.<<<,,,"""''".accccccccccccccccccccc
9
+ cccccccccccccccccccm./[}}}{{{{{=============---------------------------+++++-[;<..<<<<<<,,,"""''';'< ccccccccccccccccccc
10
+ cccccccccccccccccr?:[}}}{{{{{{=============--------------------------+++++{/,....<<<<<<<,,,""""''';;;,accccccccccccccccc
11
+ cccccccccccccccra<|}}}{{{{{{==============--------------------------+++-[;.>.....<<<<<<<,,,""""''';;;:;<mccccccccccccccc
12
+ cccccccccccccrm?'[}}{{{{{{{=============---------------------------++-]">>.......<<<<<<<,,,,"""''';;:::/;?rccccccccccccc
13
+ ccccccccccccr >/}}}{{{{================--------------------------++-|,>>.........<<<<<<,,,,""""''';;;::///"mcccccccccccc
14
+ cccccccccccm ?\}}}{{{{{{==============-------------------------++-\<>>...........<<<<<<,,,,""""''';;:::///\:?ccccccccccc
15
+ cccccccccra ?\{}{{{{{{================-----------------------++-|,>>............<<<<<<<,,,,""""''';;::://\\\\.rccccccccc
16
+ ccccccccra \{}{{{{{=================---===========---------++],>>..............<<<<<<,,,,,""""''';;:://\\||||,rcccccccc
17
+ cccccccra a:{{{{{{{======================{}[[]]][[}{==-----+}'>>...............<<<<<<<,,,,"""""''';;:://\\|||||'rccccccc
18
+ ccccccra a<{{{{{{{===================={}]/;',,<,"':\[}==-+=:>>>...............<<<<<<<,,,,,""""''';;;:://\\||]]]]'rcccccc
19
+ cccccra a [{{{{{{==================={}|:,.? aamaa ><'\[{=\<>>>...............<<<<<<<,,,,,"""""''';;::://\\|]]][[['rccccc
20
+ ccccca aa/{{{{{{==================={}\'. amrrrrrrmm >"/|">>>>................<<<<<<<,,,,,""""''';;;:://\\||]][[[[[,ccccc
21
+ ccccm aa>{{{{{{{===================}|;. mrrrrrrrrrmm <">>>>>>...............<<<<<<<,,,,,"""""''';;;:://\\||]][[}}[]>cccc
22
+ cccr am:{{{{{{==================={[/">amrrrrrrrrrrm?.>>>>>................<<<<<<<,,,,,,""""''';;;::://\\|]][[}}}}}\accc
23
+ ccra aa [{{{{{===================={[\">amrrrrrrrrra?>>>>>................<<<<<<<<,,,,,"""""'''';;;:://\\||]][}}}{{}['ccc
24
+ ccm am"={{{{======================{]:,>ammrrrrrm ?>>>>>................<<<<<<<<,,,,,,""""'''';;;:://\\\|]][[}}{=={}]?cc
25
+ cr aam\={{{=================---====}]:".? ammma?>>>>>>................<<<<<<<<,,,,,,""""'''';;;::://\\||]][}}{{==={}/rc
26
+ cm aaa[{{{=================------==={[|/'"<.<<.>>>>>.................<<<<<<<<<,,,,,""""''''';;::://\\||]][[}}{===={}{?c
27
+ c aa?}{{{==================-------==={}[]||:.>>>..................<<<<<<<<,,,,,,,""""''''';;;:://\\\|]][[[}{======{-;c
28
+ r am.={{===================-----------====/.>>..................<<<<<<<<<,,,,,,,""""''''';;;::///\\||]][[}{{==--==-+[m
29
+ m? am<={{{==============----------------+='>>..................<<<<<<<<<<,,,,,,"""""''''';;;::///\\||]][[}}{==----=_+{>
30
+ a? am<={{===============---------------+}<>....................<<<<<<<<<,,,,,,"""""''''';;;::://\\||]][[}}{{=-----_)_="
31
+ ? am<={{================-------------+].>..................<<<<<<<<<<,,,,,,,"""""'''';;;;::://\\||]][[}}{{=--+--+()_-:
32
+ am<={===============---------------/>>.................<<<<<<<<<<,,,,,,,""""""'''';;;;::///\\||]][[}}{{==--+-+**)_-\
33
+ ? am>{{==============---------------;>..................<<<<<<<<<,,,,,,,,"""""''''';;;:::///\\|||][[[}}{==--+-+**((_-|
34
+ aaa[===============-------------='>................<<<<<<<<<<,,,,,,,,"""""''''';;;;:::///\\||]][[[}}{==--+-_*&*((_-]
35
+ ? aam|=============-------------+=">...............<<<<<<<<<<,,,,,,,,""""""''''';;;;:::///\\||]][[[}}{==----)&&&*()_-|
36
+ ? aam;=============------------+{,>.............<<<<<<<<<<<,,,,,,,,,"""""''''';;;;:::///\\\||]][[[}}{==---+(&&&**()_-:
37
+ a? aam>{============-----------+}<>............<<<<<<<<<<<<,,,,,,,,"""""'''''';;;;:::///\\\||]][[}}{{{=---_*&&&&**()_-"
38
+ m? aam|============----------+}<>..........<<<<<<<<<<<<,,,,,,,,,""""""''''';;;;::::///\\|||]][[}}}{{==-+(&&&&&***()_=>
39
+ r?? aam,===========----------+}<..........<<<<<<<<<<<<,,,,,,,,,""""""''''';;;;;:::///\\\||]]][[}}{{===-)&&&&&&&**((_+[m
40
+ c ? aaaa[==========---------+{<........<<<<<<<<<<<<<,,,,,,,,,"""""''''''';;;::::////\\|||]][[[}}{{==-_*&&&&&&&**(()_+:c
41
+ cm? aam,==========---------=,.......<<<<<<<<<<<<<,,,,,,,,,""""""'''''';;;;::::///\\\||]]][[[}}{{==_*&&&&&&&&&**())_-?c
42
+ cr ? aaaa|========---------=".....<<<<<<<<<<<<<,,,,,,,,,""""""''''''';;;;::::///\\\|||]]][[}}{{{=_*&&&&&&&&&&**(()__\rc
43
+ ccm? aam>{=======---------'....<<<<<<<<<<<<<<,,,,,,,,""""""'''''';;;;;::::////\\\||]]][[[}}}{-)*&&&&&&&&&&&***())_->cc
44
+ ccr ? aam'-=====--------+/.<<<<<<<<<<<<<<<,,,,,,,,,""""""'''''';;;;;::::////\\\|||]]][[[}}{+(&&&&&&&&&&&&&***(()__/ccc
45
+ cccr?? aaa\-====-------+|.<<<<<<<<<<<<<,,,,,,,,,"""""""''''''';;;;::::////\\\|||]]][[[[}=_*&&&&&&&&&&&&&****(())_{accc
46
+ ccccm?? aaa ]-===-------{<<<<<<<<<<<<,,,,,,,,,""""""""'''''';;;;;:::://///\\\|||]][[[}{+(&&&&&&&&&&&&&&*****(())_+.cccc
47
+ ccccca? a?[-==-------'.<<<<<<<<,,,,,,,,,,"""""""''''''';;;;;::::////\\\\||]]]][[{+)*&&&&&&&&&&&&&&&*****(())__'ccccc
48
+ cccccr ? a?[-=-----+\.<<<<<,,,,,,,,,,,""""""""'''''';;;;;;::::////\\\\||||]][=_(********&&&&&&*********(())__/rccccc
49
+ ccccccr>> a?]------{,<<<,,,,,,,,,,,""""""""''''''';;;;;:::://///\\\\|||][{-_(**************&&&*******((())_)\rcccccc
50
+ cccccccr.,> ;+__+-+:<,,,,,,,,,,,"""""""""'''''''';;;;:::://///\\\\||]}-_(***************************((())))\rccccccc
51
+ ccccccccr.:;<?a>-++__--['<,,,,,,""""""""""''''''';;;;;::::://////\\][{-_)(***(***********************((((()))_:rcccccccc
52
+ cccccccccc?/]]/'{--+___()[",,""""""""""'''''''';;;;;::::::///\|[{=+)((((((((***********************((((())))+"cccccccccc
53
+ ccccccccccca'|}{{-=-+___)*+',""""""""'''''''''';;;;:://\][}=+_))(((((((((((((*******************((((((()))){>ccccccccccc
54
+ ccccccccccccr<\[}===-+___)&_/;;;''''';;;;;:://\|][}{=-+__)))))))))(((((((((((((((**((*******((((((((())))_\mcccccccccccc
55
+ cccccccccccccc ;|[{==-+___(&_{{{{{{{{{{===---++++________))))))))(((((((((((((((((((((((((((((((((()))))=<cccccccccccccc
56
+ cccccccccccccccr./]}{==-+_)(+{{======-----++++++++______))))))))))()((((((((((((((((((((((((((()))))))+:mccccccccccccccc
57
+ cccccccccccccccccm<\[}][}{=={{{{====-----+++++++_______))))))))))))))))(((((((((((((((((()))))))))))_\ ccccccccccccccccc
58
+ ccccccccccccccccccca,\||]][[}}{{====-----++++++__________)))))))))))))))))))()))))))))))))))))))))+|?ccccccccccccccccccc
59
+ ccccccccccccccccccccca<:\|]][[}{{=====----++++++++__________)))))))))))))))))))))))))))))))))_))-/?ccccccccccccccccccccc
60
+ cccccccccccccccccccccccm>'/||][[[}{{=====------+++++____________)))))))))))))))))))))))____))_}'accccccccccccccccccccccc
61
+ cccccccccccccccccccccccccra<;\|]]][[}{{=====------++++++++______________________________))_=/>rccccccccccccccccccccccccc
62
+ ccccccccccccccccccccccccccccr <;/|]]][[}{{{======------++++++++++_____________________)_{/.mcccccccccccccccccccccccccccc
63
+ cccccccccccccccccccccccccccccccra>":\|]][[}}{{{=======------++++++++++++++++++++___+=]'?rccccccccccccccccccccccccccccccc
64
+ cccccccccccccccccccccccccccccccccccr .":\|][[[}}}{{{========------------++++__+-}\">mccccccccccccccccccccccccccccccccccc
65
+ cccccccccccccccccccccccccccccccccccccccrm .,':\|][[}}{{{{======---------={[|:">arccccccccccccccccccccccccccccccccccccccc
66
+ cccccccccccccccccccccccccccccccccccccccccccccrma?><"';//\||]]]]]||\/;"<> arccccccccccccccccccccccccccccccccccccccccccccc
requirements.txt ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==5.4.1
2
+ attrs==24.2.0
3
+ blinker==1.8.2
4
+ cachetools==5.5.0
5
+ certifi==2024.8.30
6
+ charset-normalizer==3.3.2
7
+ click==8.1.7
8
+ filelock==3.16.1
9
+ fsspec==2024.9.0
10
+ gitdb==4.0.11
11
+ GitPython==3.1.43
12
+ huggingface-hub==0.25.1
13
+ idna==3.10
14
+ Jinja2==3.1.4
15
+ jsonschema==4.23.0
16
+ jsonschema-specifications==2023.12.1
17
+ markdown-it-py==3.0.0
18
+ MarkupSafe==2.1.5
19
+ mdurl==0.1.2
20
+ mpmath==1.3.0
21
+ narwhals==1.8.3
22
+ networkx==3.3
23
+ numpy==2.1.1
24
+ packaging==24.1
25
+ pandas==2.2.3
26
+ pillow==10.4.0
27
+ protobuf==5.28.2
28
+ pyarrow==17.0.0
29
+ pydeck==0.9.1
30
+ Pygments==2.18.0
31
+ python-dateutil==2.9.0.post0
32
+ pytz==2024.2
33
+ PyYAML==6.0.2
34
+ referencing==0.35.1
35
+ regex==2024.9.11
36
+ requests==2.32.3
37
+ rich==13.8.1
38
+ rpds-py==0.20.0
39
+ safetensors==0.4.5
40
+ setuptools==75.1.0
41
+ six==1.16.0
42
+ smmap==5.0.1
43
+ streamlit==1.38.0
44
+ sympy==1.13.3
45
+ tenacity==8.5.0
46
+ tokenizers==0.20.0
47
+ toml==0.10.2
48
+ torch==2.4.1
49
+ tornado==6.4.1
50
+ tqdm==4.66.5
51
+ transformers==4.45.1
52
+ typing_extensions==4.12.2
53
+ tzdata==2024.2
54
+ urllib3==2.2.3