This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def create_code_context(directory, output_file): | |
code_extensions = { | |
'.py', '.java', '.cpp', '.c', '.h', '.hpp', '.js', '.ts', | |
'.jsx', '.tsx', '.go', '.rs', '.rb', '.php', '.cs', '.md' | |
} | |
with open(output_file, 'w', encoding='utf-8') as outfile: | |
for root, _, files in os.walk(directory): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Output blank canvas | |
output = np.zeros_like(image) | |
# Making the blank canvas usable with Pillow | |
pillow_output = Image.fromarray(output) | |
pillow_drawer = ImageDraw.Draw(pillow_output) | |
for i in range(int(image_height / font_height)): | |
for j in range(int(image_width / font_width)): | |
# finding the bounding box for the next character to be inserted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Our plan is to simply check if accessing the candidate key throws an exception. | |
If an exception is not thrown, then key is present | |
Otherwise, the key is not present in our HashMap | |
*/ | |
// including everything | |
#include <bits/stdc++.h> | |
using namespace std; | |
bool checkIfKeyPresent (unordered_map<int, int> hashMap, int candidate_key){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import cv2 | |
OUTFILE = "output.mp4" | |
FRAME_FPS = 10.0 | |
FRAME_WIDTH = 640 | |
FRAME_HEIGHT = 480 | |
WINDOW_NAME = "Output Window" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Now let's test out the model on our selected images | |
# We will save all our results in a directory called "results" | |
# First we create "results" directory if it does not exist | |
if not (os.path.exists("results")): | |
os.mkdir("results") | |
# We traverse through all the files in "images" | |
for image_name in os.listdir("images"): | |
# We process only files that have one of our ALLOWED_EXTENSIONS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Since we're using Convolutional Feature Extractors available in keras.applications; | |
# We need to import them as modules | |
# Only un-comment ONE of the following code-block | |
# Uncomment below lines if you want to try out VGG-16 | |
from tensorflow.keras.applications.vgg16 import VGG16, preprocess_input | |
model = VGG16(weights='imagenet', include_top = False, input_shape=(256, 256, 3)) | |
# # Uncomment below lines if you want to try out MobileNetV2 | |
# from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2, preprocess_input |