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
# pip install install mysql-connector-python | |
import mysql.connector | |
from mysql.connector import Error | |
connection = mysql.connector.connect(host='db-mysql-fra1-08423-do-user-8476727-0.b.db.ondigitalocean.com', | |
database='defaultdb', | |
port='25060', | |
user='doadmin', | |
password='AVNS_gVLHcpWOtMuGqTO') | |
if connection.is_connected(): |
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
#!pip install sentence-transformers==2.2.0 | |
from sentence_transformers import SentenceTransformer, util | |
model = SentenceTransformer("sentence-transformers/all-mpnet-base-v2") | |
#fbInterests func takes 2 arrays which are contain interests of google and fb and returs a similarty dict with accuracy scores | |
def fbInterests(google, fb): | |
sims={} | |
for g in google: | |
for f in fb : | |
g_embedding = model.encode(g) | |
f_embedding = model.encode(f) |
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 Bio import Entrez | |
from html_parser import strip_tags | |
Entrez.email = '[email protected]' | |
pmc_id = "Write pmc id here" # papers pmc id or you can add also ids | |
fetch = Entrez.efetch(db='pmc', | |
resetmode='xml', | |
id=pmc_id, | |
rettype='full') | |
data=(fetch.read()).decode("UTF-8") |
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 | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello World!' | |