Skip to content

Instantly share code, notes, and snippets.

import pydaisi as pyd
web3 = pyd.Daisi("yogeshbansal/Web3")
#Get the latest block on Ethereum Mainnet
web3.get_latestblock().value
#Returns the current gas price in ETH
web3.get_gasPrice().value
#Returns the balance of the given account
import pydaisi as pyd
gpt_3_pdf_metadata_extraction = pyd.Daisi("laiglejm/GPT 3 PDF metadata extraction")
filename = <YOUR_PDF_FILE>
with open(filename, 'rb') as f:
pdfbytes = f.read()
gpt_3_pdf_metadata_extraction.get_metadata(pdfbytes, openai_api_key, nb_chars=2000, max_response_tokens=500).value
{"title": "Exploring the origin of thick disks using the NewHorizon and Galactica simulations",
"authors": [
{"author_name": "Minjung J. Park", "author_company": "Yonsei University"},
{"author_name": "Sukyoung K. Yi", "author_company": "Yonsei University"},
{"author_name": "Sebastien Peirani", "author_company": "Observatoire de la Cote d'Azur"},
{"author_name": "Christophe Pichon", "author_company": "Institut d'Astrophysique de Paris"},
{"author_name": "Yohan Dubois", "author_company": "Sorbonne Universite"},
{"author_name": "Hoseung Choi", "author_company": "Yonsei University"},
{"author_name": "Julien Devriendt", "author_company": "University of Oxford"},
{"author_name": "Sugata Kaviraj", "author_company": "University of Hertfordshire"},
{"name": "Developing a robust conceptual model",
"technical_field": "Geothermal Exploration",
"20_words_description": "A robust conceptual model is necessary to assess both resource risks and assist the well targeting process.",
"benefit": "Reduced exploration risk and cost",
"risk_if_not_applied": "Increased exploration risk and cost"}
{"name": "Using different strategies for different stages of the project",
"technical_field": "Geothermal Exploration",
"20_words_description": "The variation of drilling objectives in each stage of the project (exploration, appraisal, development) requires different strategies in order to minimize the associated risk and project cost.",
"benefit": "Reduced exploration risk and cost",
import pydaisi as pyd
drought_monitoring = pyd.Daisi("laiglejm/Drought Monitoring")
drought_monitoring.inference(sen2_img).value
import pydaisi as pyd
my_daisi = pyd.Daisi("username/daisiname")
my_daisi.compute(args).value #remote execution of the "compute()" function
import boto3
from botocore import UNSIGNED
from botocore.client import Config
import tempfile
s3 = boto3.client('s3', region_name='eu-central-1', config=Config(signature_version=UNSIGNED))
def get_from_lat_long(lat=0,n='N',lon=0, e='E', resolution='90'):
lat_str = str(int(lat))
@Johnbt2016
Johnbt2016 / call-edges-detect.py
Last active June 7, 2022 22:05
Call edges detection Daisi
# Import pydaisi
import pydaisi as pyd
# Instantiate a Daisi object
edge_image_computation = pyd.Daisi("laiglejm/Edge Image computation")
# Call the endpoint of the compute_deriv() function
# and return the result immediately with the .value attribute
edge_image_computation.compute_deriv(image=None).value
@Johnbt2016
Johnbt2016 / edge-detect-streamlit-app.py
Created June 7, 2022 21:30
Edge Detection Streamlit app
import streamlit as st
from PIL import Image, ImageOps
def st_ui():
'''
Function running the Streamlit UI.
Doesn't return anything.
'''
st.set_page_config(layout = "wide")
import numpy as np
from scipy import signal, misc
from copy import deepcopy
def compute_deriv(image = None):
'''
Compute an edge image (the second derivative of a smoothed spline)
Arguments:
- image (2D Numpy array) : grayscale image