Skip to content

Instantly share code, notes, and snippets.

View skolo-online's full-sized avatar

Skolo Online Learning skolo-online

View GitHub Profile
@skolo-online
skolo-online / landing-page-functions.py
Created September 17, 2022 15:17
Landing page functions
from .aigenerator import *
def getDescription(businessName, businessDo, length):
description = returnSection1Description(businessName, businessDo)
if len(description) < length:
return description
else:
desc_list = description.split('.')
@skolo-online
skolo-online / landing-page-views.py
Last active September 17, 2022 15:16
Landing page views
from django.shortcuts import render, redirect
from .models import *
from .aigenerator import *
from .functions import *
from django.contrib import messages
from django.conf import settings
import time
def home(request):
@skolo-online
skolo-online / landing-page-prompt.py
Created September 17, 2022 14:49
Landing Page Prompts
import os
import openai
from django.conf import settings
openai.api_key = settings.OPENAI_API_KEY
def returnSection1Title(businessDo):
response = openai.Completion.create(
@skolo-online
skolo-online / landing-page-model.py
Created September 17, 2022 14:10
Landing page model
from django.db import models
from django.template.defaultfilters import slugify
from django.contrib.auth.models import User
from django.utils import timezone
from uuid import uuid4
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
@skolo-online
skolo-online / codexFlask.py
Created January 31, 2022 08:01
Flask Application Generated by Codex
import requests
from flask import Flask, render_template, request
app = Flask(__name__)
# Get the news stories
api_key = None
base_url = None
def configure_request(app):
@skolo-online
skolo-online / codexx.py
Created January 31, 2022 07:57
OpenAI API codex snippet
import os
import openai
import config
openai.api_key = config.OPENAI_API_KEY
def runSomeCode():
response = openai.Completion.create(
engine="code-davinci-001",
@skolo-online
skolo-online / view.py
Created January 17, 2022 06:56
Content generator view function
from flask import Flask, render_template, request
import config
import aicontent
def page_not_found(e):
return render_template('404.html'), 404
app = Flask(__name__)
app.config.from_object(config.config['development'])
@skolo-online
skolo-online / aicontent.py
Created January 17, 2022 06:50
AI Content Generator with Python Flask and OpenAI
import openai
import config
openai.api_key = config.OPENAI_API_KEY
def openAIQuery(query):
response = openai.Completion.create(
engine="davinci-instruct-beta-v3",
prompt=query,
temperature=0.8,
@skolo-online
skolo-online / class.html
Created January 9, 2022 06:47
Front end HTML template for tweet classification
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Skolo Online Learning">
<title>Skolo</title>
<link rel="shortcut icon" type="image/x-icon" href="{{ url_for('static', filename='images/favicon.png') }}">
@skolo-online
skolo-online / app.py
Created January 9, 2022 06:43
Tweet Classification App.py Route
@app.route('/classify', methods=["GET", "POST"])
def classify():
query = 'Polokwane lang:en -is:retweet'
if request.method == 'POST':
query = '{} lang:en -is:retweet'.format(request.form['query'])
max_results = 20