Skip to content

Instantly share code, notes, and snippets.

View cyberandy's full-sized avatar
:octocat:
Yo!

Andrea Volpini cyberandy

:octocat:
Yo!
View GitHub Profile
@cyberandy
cyberandy / wordlift-graphql-data-agent-powered-by-llamaindex-a-simple-demo.ipynb
Last active September 26, 2023 14:05
wordlift-graphql-data-agent-powered-by-llamaindex-a-simple-demo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"embeddings": [
{
"tensorName": "My tensor",
"tensorShape": [
1000,
50
],
"tensorPath": "https://gist.githubusercontent.com/cyberandy/d85af5a612c9763928542708c0ac0bf6/raw/b0c02e2f4324657ec7632e6a1e3cffc138e4a845/embeddings_vectors_porsche.tsv",
"metadataPath": "https://gist.githubusercontent.com/cyberandy/9a629edef01df3255d1e33b9875eadc9/raw/aab52346e227428ee1cf5d85dd4f7fbf2e227918/embeddings_meta_porsche.tsv"
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
0-100 porsche macan
0-60 porsche macan
1 porsche cayenne
1. porsche 911
1950s porsche
1950s porsche speedster
1955 porsche 356
1956 porsche 356
1956 porsche speedster
1959 porsche
@cyberandy
cyberandy / embeddings_vectors_porsche.tsv
Created December 15, 2021 13:55
embeddings_vectors_porsche
We can't make this file beautiful and searchable because it's too large.
-0.5113864 0.9224017 0.8275403 0.011984834 0.76330054 0.33919206 0.28311774 0.14538139 0.7499551 -0.03052776 0.10189354 0.99692094 -1.2256945 -0.02824433 0.162615 -0.051211037 -0.41829008 0.7155175 0.14836389 0.008838273 0.8170797 0.25933984 -0.16603503 0.44063374 0.08697651 -0.24981156 0.16387565 0.09536284 -0.37290013 0.050002567 0.2126679 0.35391727 0.2208684 0.14932127 -0.13903382 -0.30882716 -0.58008456 0.067993 0.26419926 0.028330343 0.06412557 0.14603412 -0.5382476 -1.1023028 0.92313683 0.5652307 -0.5976789 -0.08452714 -0.6236737 0.13708875 -0.045952026 0.32799286 0.12108048 -1.1154692 -0.09747529 0.20141003 -0.14496945 -1.254203 -0.3187798 1.0494366 0.06164006 -0.21705215 0.14927948 -0.097200364 0.3465199 -0.42689615 0.09920918 0.19603547 -0.5898324 -0.34810644 0.72347945 -0.60483193 0.7405867 0.65496427 0.36481908 0.13829523 -1.104363 0.23256357 0.46551976 0.01618421 0.32897347 -0.45708355 -0.34825176 0.96820194 0.6563605 -0.2686824 1.2559417 -0.80211407 0.28347582 -0.053863037 0.34286124 -0.4816527
{
"embeddings": [
{
"tensorName": "My tensor",
"tensorShape": [
1000,
50
],
"tensorPath": "https://gist.githubusercontent.com/cyberandy/f40e161d69188df7d5a901b50a64f0fe/raw/674f5c78a0c33d6b6a3da4d726ef918938d4bd68/embeddings_projectors.tsv",
"metadataPath": "https://gist.githubusercontent.com/cyberandy/092f00976a842497a113280197cb61d7/raw/6aab7043891897269c5c35df81f878e4e0a040b1/embeddings_meta.tsv"
@cyberandy
cyberandy / embeddings_meta.tsv
Last active December 8, 2021 15:16
KG embeddings meta
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
wl0216/entity/artificial_intelligence
wl0216/entity/gennaro_cuofano
wl0216/entity/google
wl0216/entity/google_analytics
wl0216/entity/how_to_optimize_your_website_for_voice_search
wl0216/entity/json-ld
wl0216/entity/knowledge_graph
wl0216/entity/metadata
wl0216/entity/microdata_html
wl0216/entity/natural_language_processing
@cyberandy
cyberandy / embeddings_projectors.tsv
Last active December 8, 2021 15:13
KG embeddings WordLift Blog
We can't make this file beautiful and searchable because it's too large.
-1.939915269613265991e-01 1.591661721467971802e-01 -1.672201305627822876e-01 1.209882497787475586e-01 -5.643929913640022278e-02 4.935293793678283691e-01 -6.038862466812133789e-02 -1.090269684791564941e-01 2.572527155280113220e-02 3.857810050249099731e-02 -1.982329189777374268e-01 -1.586464643478393555e-01 2.125328406691551208e-02 -4.903687909245491028e-02 1.097567379474639893e-01 -9.682913124561309814e-02 -1.226566657423973083e-01 -2.898987829685211182e-01 5.542956665158271790e-02 1.637598723173141479e-01 9.308864921331405640e-02 9.676701575517654419e-02 -1.217111721634864807e-01 -1.757894456386566162e-01 -4.662900418043136597e-02 -1.659229546785354614e-01 1.724372655153274536e-01 8.154600858688354492e-02 -1.724783033132553101e-01 3.298109024763107300e-02 -1.414460539817810059e-01 3.574710339307785034e-02 -2.298669368028640747e-01 8.744690567255020142e-02 -1.625491678714752197e-01 -1.283032745122909546e-01 -2.943382263183593750e-01 -6.229398399591445923e-02 1.395162492990493774e-01 -1.934481412172317505e-01 -
@cyberandy
cyberandy / lodgingbusiness-wordlift-markup
Last active March 24, 2023 06:47
Example of a JSON-LD for LodgingBusiness that WordLift produces
[
{
"@context": "http://schema.org",
"@id": "http://data.wordlift.io/[entity-name]",
"@type": ["LodgingBusiness"],
"description": "Here goes the description",
"mainEntityOfPage": "https://www.happywordliftclient.com",
"image": [
{ "@type": "ImageObject", "url": "https://www.happywordliftclient.com/wp-content/uploads/2011/07/img-19az-1200x675.jpg", "width": 1200, "height": 675 },
{ "@type": "ImageObject", "url": "https://www.happywordliftclient.com/wp-content/uploads/2011/07/img-19az-1200x900.jpg", "width": 1200, "height": 900 },
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://wordlift.io/blog/en/#website",
"type": "http://schema.org/WebSite",
"http://schema.org/alternateName": "SEO made simple",
"http://schema.org/name": "WordLift Blog",
"http://schema.org/potentialAction": {
"type": "http://schema.org/SearchAction",
"http://schema.org/query-input": "required name=search_term_string",
"http://schema.org/target": "https://wordlift.io/blog/en/?s={search_term_string}"
import requests
from bs4 import BeautifulSoup
import time
USER_AGENT = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
def fetch_results(search_term, number_results, language_code):
assert isinstance(search_term, str), 'Search term must be a string'
assert isinstance(number_results, int), 'Number of results must be an integer'