Skip to content

Instantly share code, notes, and snippets.

View Terieyenike's full-sized avatar
🐙
I know nothing, working everyday.

Oteri Eyenike Terieyenike

🐙
I know nothing, working everyday.
View GitHub Profile
@Terieyenike
Terieyenike / Program.cs
Created November 11, 2024 07:40
Project: Building a Console-Based Calculator
Console.WriteLine("Console bassed calculator\n");
Console.WriteLine("========================");
bool continueCalculating = true;
while (continueCalculating)
{
Console.WriteLine("Enter your first number: ");
string? firstInput = Console.ReadLine();
if (firstInput == null)
@Terieyenike
Terieyenike / app.py
Created October 1, 2024 19:44
An interactive chatbot that simulates conversations with a chosen celebrity using the OpenAI API.
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv("OPENAI_API_KEY")
from openai import OpenAI
client = OpenAI()
famous_person = input("What celebrity would you like to talk to?\n")
@Terieyenike
Terieyenike / tic_tac_toe.py
Last active September 11, 2024 10:11
Tic Tac Toe with AI opponent
import random
# Board setup and functions
def print_board(board):
print(f'{board[0]} | {board[1]} | {board[2]}')
print('---------')
print(f'{board[3]} | {board[4]} | {board[5]}')
print('---------')
print(f'{board[6]} | {board[7]} | {board[8]}')
@Terieyenike
Terieyenike / app.py
Last active September 4, 2024 22:09
Build Your First Game (Snake Game) With AI and Python
import pygame
import time
import random
# Initialize pygame
pygame.init()
# Define colors
dark_gray = (30, 30, 30) # Background color
white = (255, 255, 255) # Score text color
@Terieyenike
Terieyenike / main.py
Created August 21, 2024 09:42
Text to Speech (TTS) API
import os
from dotenv import load_dotenv
from openai import OpenAI
client = OpenAI()
api_key = os.getenv('OPENAI_API_KEY')
text = 'In the future, we may be able to travel to other galaxies using wormholes or warp drives.'
@Terieyenike
Terieyenike / app.py
Created August 21, 2024 09:26
Translation with Whisper
import os
from dotenv import load_dotenv
from openai import OpenAI
client = OpenAI()
api_key = os.getenv('OPENAI_API_KEY')
file = 'audio/german.mp3'
with open(file, 'rb') as audio_file:
@Terieyenike
Terieyenike / app.py
Created August 21, 2024 09:21
Transcriptions with Whisper
import os
from dotenv import load_dotenv
from openai import OpenAI
client = OpenAI()
api_key = os.getenv('OPENAI_API_KEY')
file = 'audio/rr.mp3'
with open(file, 'rb') as audio_file:
@Terieyenike
Terieyenike / app.py
Created August 18, 2024 16:07
Prompt Engineering for Python Developers
from openai import OpenAI
client = OpenAI()
import os
from dotenv import load_dotenv
api_key = os.getenv("OPENAI_API_KEY")
def get_chat_completion(user_prompt, system_role='You are a helpful assistant',
model='gpt-3.5-turbo', temperature=1):
messages = [
@Terieyenike
Terieyenike / main.py
Created August 17, 2024 08:55
Local Base64 Images as Input
from IPython.display import Image, display
image_path = 'images/triangle2.jpg'
display(Image(image_path, width=400))
import base64
def encode_image(image_path):
with open(image_path, 'rb') as image_file:
image_binary_data = image_file.read()
return base64.b64encode(image_binary_data).decode('utf-8')
@Terieyenike
Terieyenike / main.py
Last active August 17, 2024 08:54
Explore GPT-4o's Vision Capabilities
from dotenv import load_dotenv
api_key = os.getenv("OPENAI_API_KEY")
from openai import OpenAI
client = OpenAI()
model = 'gpt-4o'
response = client.chat.completions.create(
model = model,