This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask, render_template, g, redirect, url_for | |
| from flask_oidc import OpenIDConnect | |
| from okta import UsersClient, UserGroupsClient | |
| import requests | |
| from oauth2client.client import OAuth2Credentials | |
| import json | |
| app = Flask(__name__) | |
| app.config.update({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import os | |
| df = pd.read_csv('Flight-1-export.csv') | |
| df["label"] = df["label"].str.lower() | |
| groups = df.groupby(['image', "xmin", "ymin", "xmax", "ymax"]).groups | |
| group_values = list(groups.values()) | |
| grouped_indices = list(map(lambda x: x.to_list(), group_values)) | |
| for index in grouped_indices: | |
| df.loc[index[0], "labels"] = ",".join([df.loc[idx, "label"] for idx in index]) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jupyterlab_dash | |
| import dash | |
| import dash_html_components as html | |
| import dash_core_components as dcc | |
| import dash_table as dt | |
| import pandas as pd | |
| import pickle | |
| from dash.dependencies import Input, Output, State |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Code snippet posted on OpenCV website. | |
| # Jain tested on Ubuntu 18.04. | |
| # For windows, follow this blog https://www.codepool.biz/web-camera-recorder-oepncv-flask.html | |
| import numpy as np | |
| import cv2 | |
| cap = cv2.VideoCapture(0) | |
| # Define the codec and create VideoWriter object | |
| fourcc = cv2.VideoWriter_fourcc(*'XVID') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Check if result_ext folder exists inside the folder. If not make the folder | |
| Read the original file | |
| Unlock the file in all cases, even if it is unlocked. It is fairly inexpensive operation. | |
| Split the files. Each page is separated into a temporary file. | |
| Read from each of the split file into a dataframe and then delete that file. | |
| If the page has table then read it from the dataframe and extract the data. Camelot is used to do that. | |
| Read all the text using Tika. | |
| Split the text based on newline character. This will give many lists. Use regular expression to get lists that begin with 4 digits. | |
| Concatenate all the dataframes . | |
| Save all the concatenated dataframes into a final dataframe if the number of columns is 10. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tika | |
| tika.initVM() | |
| from tika import parser | |
| import camelot | |
| import pandas as pd | |
| import re | |
| #filename = "Sample3_unconsolidated.pdf" | |
| filename = "Sample3_consolidated.pdf" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #install camelot or something like that for using PyPDF2 | |
| from PyPDF2 import PdfFileWriter, PdfFileReader | |
| inputpdf = PdfFileReader(open("1_extractable.pdf", "rb")) | |
| for i in range(inputpdf.numPages): | |
| output = PdfFileWriter() | |
| output.addPage(inputpdf.getPage(i)) | |
| with open("document-page%s.pdf" % i, "wb") as outputStream: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install pikepdf using `pip install pikepdf` | |
| import pikepdf | |
| pdf = pikepdf.open('unextractable.pdf') | |
| pdf.save('extractable.pdf') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // pull down jquery into the JavaScript console | |
| var script = document.createElement('script'); | |
| script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"; | |
| document.getElementsByTagName('head')[0].appendChild(script); | |
| // grab the URLs | |
| var urls = $('.rg_di .rg_meta').map(function() { return JSON.parse($(this).text()).ou; }); | |
| // write the URls to file (one per line) | |
| var textToSave = urls.toArray().join('\n'); | |
| var hiddenElement = document.createElement('a'); | |
| hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave); |
NewerOlder