This file contains 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 .py doc with to run | |
subInterp.eval("import python_functions as p"); | |
// run each function from the .py doc I | |
subInterp.eval("res_spacy = p.run_spacy_nlp('Apple is looking at buying U.K. startup for $1 billion')"); | |
System.out.println(subInterp.getValue("res_spacy")); | |
//II | |
subInterp.eval("res_c = p.get_c_path('.idea','*.xml')"); | |
System.out.println(subInterp.getValue("res_c")); |
This file contains 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
// set path for jep executing python3.9 | |
MainInterpreter.setJepLibraryPath(jepPath); | |
// set path for python docs with python script to run | |
jep.JepConfig jepConf = new JepConfig(); | |
jepConf.addIncludePaths(System.getProperty("user.dir")+"/src/main/java/"); | |
//create the interpreter for python executing | |
Interpreter subInterp = jepConf.createSubInterpreter(); |
This file contains 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
// run function from the python_functions.py document | |
subInterp.eval("import python_functions as p"); | |
subInterp.eval("res_spacy = p.run_spacy_nlp('Apple is looking at buying U.K. startup for $1 billion')"); | |
ArrayList result = (ArrayList) subInterp.getValue("res_spacy"); | |
for (Object item:result) { | |
System.out.println(item.toString()); | |
} |
This file contains 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 glob | |
import os | |
import spacy | |
def get_c_path(pathlib, extension): | |
path_list = glob.glob(f'{pathlib}/' + f'{extension}') | |
return path_list | |
This file contains 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
jep.JepConfig jepConf = new JepConfig(); | |
jepConf.addIncludePaths("/Users/galinablokh/Documents/POCNerClassificationSDK/src/main/java"); | |
jepConf.addIncludePaths(pythonFolder); | |
SharedInterpreter.setConfig(jepConf); | |
SharedInterpreter subInterp = new SharedInterpreter(); |
This file contains 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 jep.*; | |
import jep.MainInterpreter; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.util.ArrayList; | |
String pythonFolder = System.getenv("DYLD_LIBRARY_PATH"); |
This file contains 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
<dependency> | |
<groupId>black.ninia</groupId> | |
<artifactId>jep</artifactId> | |
<version>4.0.3</version> | |
<scope>compile</scope> | |
</dependency> |
This file contains 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 pickle | |
import pandas as pd | |
from pattern.text import Sentence | |
from pattern.text.en import sentiment, parse, modality | |
import torch | |
from transformers import AutoTokenizer, AutoModel | |
from flask import render_template, request, Flask | |
MODEL_PATH = 'data/model_for_prediction.pkl' | |
file = open(MODEL_PATH, 'rb') |
This file contains 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
body{ | |
font:15px/1.5 Arial, Helvetica,sans-serif; | |
padding: 0; | |
background-color: #f4f3f3; | |
} | |
.container{ | |
text-align:center; | |
width:100%; |
This file contains 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
<!DOCTYPE html> | |
<html lang="en-us"> | |
<head> | |
<title></title> | |
<link rel="stylesheet" type="text/css" href="../static/style.css"> | |
</head> | |
<body> | |
<header> | |
<div class="container"> | |
<div id="brandname"> |
NewerOlder