Skip to content

Instantly share code, notes, and snippets.

View si3mshady's full-sized avatar
🐍

Elliott Arnold si3mshady

🐍
View GitHub Profile
@si3mshady
si3mshady / pdf_reader_translation.py
Created October 9, 2024 11:39
This script is a PDF reader with translation features using PyQt5 and PyMuPDF, allowing users to double-click words for definitions and Spanish translations via the OpenAI API, requiring the `OPENAI_API_KEY` environment variable.
import sys
import os
import fitz # PyMuPDF
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QVBoxLayout,
QWidget,
QPushButton,
QFileDialog,
@si3mshady
si3mshady / Readme.md
Created October 8, 2024 15:21
This Python script uses AI to translate videos from one language to another, including both audio and subtitles

Video Translator

This Python script uses AI to translate videos from one language to another, including both audio and subtitles.

Features

  • Extracts audio from input video
  • Transcribes and translates audio using OpenAI's Whisper model
  • Generates timed subtitles in the target language
  • Creates Text-to-Speech (TTS) audio in the target language
@si3mshady
si3mshady / video_subtitle_transformer.py
Created October 8, 2024 12:19
This Python script, video_subtitle_transformer.py, is designed to extract audio from video files, transcribe and translate the audio into a specified language using OpenAI's Whisper API, and then generate and embed timed subtitles directly into the video.
import os
import moviepy.editor as mp
import subprocess
from openai import OpenAI
from pydub import AudioSegment
# Set OpenAI API Key
key = os.environ.get("OPENAI_API_KEY")
if not key:
raise ValueError("OPENAI_API_KEY environment variable not set")
@si3mshady
si3mshady / ai_drone_takeoff_landing.py
Created October 6, 2024 09:17
Drone Control with AI Agents and Natural Language Commands - Here’s a description you can use for the GitHub Gist: Drone Control with AI Agents and Natural Language Commands This Python script leverages AI agents to control the takeoff, landing, and in-flight commands of a drone using natural language input. The code is designed to allow users t…
import time
from dronekit import connect, VehicleMode
from langchain.agents import initialize_agent, AgentType
from langchain_openai import OpenAI
from langchain.tools import Tool
# Set target altitude and manual arm setting
targetAltitude = 3
manualArm = False
@si3mshady
si3mshady / voice_ai_agent.py
Created September 24, 2024 10:17
This Python script sets up a bi-directional Voice AI Agent using Flask, Twilio, and OpenAI. The agent receives and processes voice input from callers in real-time, leveraging Twilio's telephony capabilities to manage the call flow and OpenAI's GPT-4 model to generate intelligent, context-aware responses. The code ensures seamless, interactive co…
from flask import Flask, request, jsonify
import os
from twilio.rest import Client
from twilio.twiml.voice_response import Gather, VoiceResponse
from dotenv import load_dotenv
import openai
# Load environment variables from .env file
load_dotenv()
@si3mshady
si3mshady / Readme.md
Created September 7, 2024 19:31
The Email Categorization App organizes Gmail emails with OpenAI and visualizes data using interactive charts for streamlined management.

Here's a README file for your GitHub project:


Email Categorization App

The Email Categorization App automatically fetches and organizes your Gmail emails using OpenAI's GPT-3.5 model. It categorizes emails into concise groups (Security, Work, Personal, Marketing, Spam, and Other) and visualizes the data with interactive charts, making email management effortless.

Features

@si3mshady
si3mshady / ScreenshotToWord.py
Created August 26, 2024 22:02
Tool that uses a widget to take screenshots and saves them in word document
# You can create a Python program to automatically add screenshots to a Word document using the `python-docx` library, along with the `pyautogui` library to capture screenshots. Here's a basic script to achieve this:
# ### 1. Install Required Libraries
# First, you need to install the necessary Python libraries:
# ```bash
# pip install python-docx pyautogui pillow
# ```
# ### 2. Python Script
@si3mshady
si3mshady / dynamic_autogen.py
Created June 8, 2024 18:05
Python script that accepts command line input and will generate and execute code
from pathlib import Path
import sys,os
import tempfile
from autogen import ConversableAgent
from autogen.coding import DockerCommandLineCodeExecutor
# python3 -m venv pyautogen
# source pyautogen/bin/activate
# pip install pyautogen
@si3mshady
si3mshady / action.yml
Created June 8, 2024 18:02
Github action that will install docker and autogen script cicd_autogen.py
name: Install Docker on CentOS
on:
push:
branches:
- main
jobs:
install-docker:
@si3mshady
si3mshady / sample_avatar_in_frontend.js
Created June 4, 2024 13:19
React code with D-ID avatar
import React, { useState, useEffect, useRef } from 'react';
// import ReactDOM from 'react-dom';
import trinity from './trinity.mp4'
import './App.css';
function App() {
const maxRetryCount = 3;
const maxDelaySec = 4;
const REACT_APP_INIT_SCRIPT = process.env.REACT_APP_INIT_SCRIPT || "Hey Elliott, what are we going to work on today? Wait, why do I even need to ask I already know it will be fun";