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 asyncio | |
import websockets | |
import json | |
import string | |
import random | |
import pickle | |
def random_filename(path=None, length=None): | |
text = string.ascii_uppercase + string.ascii_lowercase + string.digits |
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
from django.contrib import admin | |
from django.urls import path | |
from django.views.generic import TemplateView | |
from django.conf import settings | |
from django.conf.urls.static import static | |
import path | |
from pixelart import views |
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
model = Sequential() | |
model.add(Conv2D(64, (3, 3), input_shape=(200, 200, 1))) | |
model.add(Activation('relu')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Conv2D(32, (3, 3))) | |
model.add(Activation('relu')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Conv2D(16, (3, 3))) |
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 | |
import sys | |
import cv2 | |
import random | |
import numpy as np | |
from tqdm import tqdm | |
import pickle |
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
train_images = os.listdir('data/train') | |
train_images[:10] | |
>>> | |
['cat.4213.jpg', | |
'cat.7203.jpg', | |
'dog.8250.jpg', | |
'dog.7907.jpg', | |
'dog.2318.jpg', | |
'cat.6480.jpg', |
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
def get_hsv_positions(image, positions): | |
#hsv comes in hue (color of image), saturation and value that's supposed to be how light or dark the color is | |
image = image.filter(ImageFilter.BLUR) | |
hsv_image = image.convert('HSV') | |
values = [] | |
for pixel in positions: | |
values.append(hsv_image.getpixel(tuple(pixel))) |
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
window.onload = function () { | |
var app = new Vue({ | |
delimiters: ['[[', ']]'], | |
el: '#app', | |
data: { | |
messages: [], | |
input: '', | |
send_blank: false, | |
placeholder: 'Send a message to the chatbot...', | |
}, |
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
{% extends 'base.html' %} | |
{% block js %} | |
<script type="text/javascript" src="/static/js/script.js"></script> | |
{% endblock %} | |
{% block content %} | |
<div id="app" class="container top-padding"> | |
<div class="row"> | |
<div class="col-md-12"> | |
<div class="card col-md-6" v-for="message in messages" v-bind:class="{ 'user-message': message.user, 'chat-message': message.chat_bot, 'offset-md-6': message.chat_bot}"> | |
<div class="card-body"> |
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
from django.shortcuts import render, render_to_response | |
from django.http import HttpResponse | |
import json | |
from django.views.decorators.csrf import csrf_exempt | |
from chatterbot import ChatBot | |
chatbot = ChatBot( | |
'Ron Obvious', | |
trainer='chatterbot.trainers.ChatterBotCorpusTrainer' | |
) | |
# Train based on the english corpus |
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 asyncio | |
import websockets | |
import json | |
from chatterbot import ChatBot | |
chatbot = ChatBot( | |
'Ron Obvious', | |
trainer='chatterbot.trainers.ChatterBotCorpusTrainer' | |
) |