Skip to content

Instantly share code, notes, and snippets.

View a-lakhanpal's full-sized avatar
🤓

Ankur Lakhanpal a-lakhanpal

🤓
View GitHub Profile
import torch
import streamlit as st
from transformers import BartTokenizer, BartForConditionalGeneration
from transformers import T5Tokenizer, T5ForConditionalGeneration
st.title('Text Summarization Demo')
st.markdown('Using BART and T5 transformer model')
model = st.selectbox('Select the model', ('BART', 'T5'))
@a-lakhanpal
a-lakhanpal / serp_heatmap.py
Created May 20, 2022 23:40 — forked from eliasdabbas/serp_heatmap.py
Create a heatmap of SERPs, using a table with columns: "keyword", "rank", and "domain"
import plotly.graph_objects as go
import pandas as pd
def serp_heatmap(df, num_domains=10, select_domain=None):
df = df.rename(columns={'domain': 'displayLink',
'searchTerms': 'keyword'})
top_domains = df['displayLink'].value_counts()[:num_domains].index.tolist()
top_domains = df['displayLink'].value_counts()[:num_domains].index.tolist()
top_df = df[df['displayLink'].isin(top_domains) & df['displayLink'].ne('')]
# TIPS
1) Remove the count function and paste into dev tools to test further
2) To spot additonal oportunities swap the img selector to video, iframe or wildcards
3) Render JS in SF to discover all images and spot differences
4) Spot check source to find different lazy loading libraries e.g. Lazysizes, JQuery Lazy, yall.js etc
# CAVEATS
1) Don't forget to check background CSS images
2) Other implimentaiton techniques may exist, adapt this approach to suit your needs e.g yall.js - lazy-bg-loaded
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
yaml_config="""
input_features:
-
name: Original_Title
type: text
level: word
encoder: t5
reduce_output: null
-
name: Keyword
/**
* A bookmarklet for viewing the largest contentful paint in a page.
* Will show each LCP after the bookmarklet is clicked.
*
* To install:
* 1. Copy the code starting from the line beginning `javascript:`
* 2. Add a new bookmark in Chrome, and paste the code in as the URL.
**/
javascript:(function(){
try {
@a-lakhanpal
a-lakhanpal / YouTube-Playlists-Subtitles.ipynb
Created May 19, 2021 09:02 — forked from pshapiro/YouTube-Playlists-Subtitles.ipynb
Download auto-generated subtitles from a YouTube playlist and do a term frequency analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@a-lakhanpal
a-lakhanpal / YouTube-Playlists-Subtitles.ipynb
Created May 19, 2021 09:02 — forked from pshapiro/YouTube-Playlists-Subtitles.ipynb
Download auto-generated subtitles from a YouTube playlist and do a term frequency analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@a-lakhanpal
a-lakhanpal / main.py
Last active April 16, 2021 08:08 — forked from garrettmojica/main.py
Using Python to scrape beyond Google’s 4 initial “People also ask” Questions
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from bs4 import BeautifulSoup
import xlsxwriter
import datetime
import time
import os
def returnChromeDriver(pathToChromeDriver):