Skip to content

Instantly share code, notes, and snippets.

@tejeshb
tejeshb / database_con.py
Created January 19, 2022 17:20
Supabase Connection
# Import Libraries
import os
from supabase import create_client, Client
url: str = os.environ.get("SUPABASE_URL")
key: str = os.environ.get("SUPABASE_KEY")
supabase: Client = create_client(url, key)
# Function to Fetch All Teams
@tejeshb
tejeshb / Dockerfile
Created January 19, 2022 11:03
Dockerfile with out Java Dependancy
FROM amazon/aws-lambda-python:3.8
ARG FUNCTION_DIR="/var/task/"
COPY ./ ${FUNCTION_DIR}
# Setup Python environment
RUN pip install requirements.txt
# Grab the zappa handler.py and put it in the working directory
@tejeshb
tejeshb / Dockerfile
Created January 19, 2022 10:57
Dockerfile for Flask API
FROM public.ecr.aws/lambda/python:3.8
ARG FUNCTION_DIR="/var/task/"
COPY ./ ${FUNCTION_DIR}
# Install OpenJDK
RUN yum install -y java-1.8.0-openjdk
@tejeshb
tejeshb / pdf_to_json.py
Created January 14, 2022 06:44
Pdf to Json Flask app
#import libraries
import json
from flask import request, jsonify,Flask
import pandas as pd
import urllib.request
import PyPDF2
import io
import time
from tabula.io import read_pdf
@tejeshb
tejeshb / pdf_to_df.py
Last active January 21, 2022 02:27
Function to get data frame from pdf URL
# Function to get dataframe from PDF
def pdf_to_df(URL):
'''
:param URL:
:return: list of dataframes for each page of pdf
'''
start_time = time.time()
req = urllib.request.Request(url_path, headers={'User-Agent': "Magic Browser"})
remote_file = urllib.request.urlopen(req).read()
remote_file_bytes = io.BytesIO(remote_file)
@tejeshb
tejeshb / medley_creator.ipynb
Last active January 14, 2021 08:28
Medley_Creator.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tejeshb
tejeshb / splitsong.py
Created January 12, 2021 18:53
Split songs code
duration = []
start_time = []
end_time = []
dur = []
c = 0
for tr in tr_all:
start_time.append([])
end_time.append([])
duration.append([])
@tejeshb
tejeshb / Medley_generator.ipynb
Last active January 12, 2021 19:03
Copy of spleeter.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import streamlit as st
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt
st.set_page_config(
layout='wide')
st.title("Topic Finder")
pytrend_word = st.sidebar.text_input("Google Trend Search Term",google_topic)
newsapi = NewsApiClient(api_key=news_key)
news_list= []
def newtrends(keyword):
try:
top_headlines = newsapi.get_everything(q=keyword,
from_param=last_week,
to=today, language='en')
i = 0