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 / assistants_api_v2_streamlit.py
Created May 4, 2024 10:37
Assistant API V2 Streamlit Application
import streamlit as st
from assistant import *
import time
def process_run(st, thread_id, assistant_id):
# Run the Assistant
run_id = runAssistant(thread_id, assistant_id)
status = 'running'
# Check Status Session
@skolo-online
skolo-online / assistants_api_v2.py
Created May 4, 2024 10:35
Assistants API V2 Code
from openai import OpenAI
import config
import os
def createAssistant(file_ids, title):
#Create the OpenAI Client Instance
client = OpenAI(api_key=config.API_KEY)
@skolo-online
skolo-online / talking_assistant.py
Created December 23, 2023 11:03
Talking AI Assistant Application on Streamlit
# pip install streamlit
# pip install audio-recorder-streamlit
# pip install openai
import streamlit as st
from audio_recorder_streamlit import audio_recorder
from openai import OpenAI
API_KEY = 'enter-openai-api-key-here'
@skolo-online
skolo-online / build_business_plan.py
Created January 3, 2023 17:55
Building the Business Plan
from .aifile import *
import asyncio
loop = asyncio.new_event_loop()
## PDF Generation Stuff
import pdfkit
from django.template.loader import get_template
import os
@skolo-online
skolo-online / handleWhatsAppChat.py
Created January 3, 2023 17:32
WhatsApp Function Handle WhatsApp Chat
from .models import *
from django.contrib.auth.models import User
def handleWhatsAppChat(fromId, profileName, phoneId, text):
##Check if there is a chat session
try:
chat = ChatSession.objects.get(profile__phoneNumber=fromId)
except:
@skolo-online
skolo-online / whatsapp_chat_model.py
Created January 3, 2023 17:11
Whatsapp Business Plan Chat Model
from django.db import models
from django.utils import timezone
from uuid import uuid4
class ChatSession(models.Model):
OPTIONS = [
('(Pty) Ltd', '(Pty) Ltd'),
('Not Profit', 'Not Profit'),
@skolo-online
skolo-online / receive_whatsapp_message.py
Created January 3, 2023 15:26
Receive WhatsApp Message via webhook
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
import json
@csrf_exempt
def whatsAppWebhook(request):
if request.method == 'GET':
VERIFY_TOKEN = 'enter-your-verify-token-here'
mode = request.GET['hub.mode']
@skolo-online
skolo-online / send_Whatsapp_message.py
Created January 3, 2023 15:16
Send a WhatsApp message
import requests
phoneNumber = '27738892232'
message = 'Hello there, this was sent from Django'
token = 'Bearer xxxxx-your-whatsapp-token-goes-here-xxxxxxxxxxxx'
url = 'https://graph.facebook.com/v15.0/110244361711861/messages'
def sendWhastAppMessage(phoneNumber, message):
headers = {"Authorization": token}
@skolo-online
skolo-online / landing-page-website.html
Created September 17, 2022 15:33
Landing Page Website HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>{{businessName}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Description" />
<meta name="keywords" content="Keywords" />
<meta content="Themesbrand" name="author" />
@skolo-online
skolo-online / landing-page-index.html
Created September 17, 2022 15:29
Landing Page Index File
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Skolo Online</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
</head>
<body>
<div class="container">