Spaces:
Runtime error
Runtime error
| # Import necessary libraries | |
| import streamlit as st | |
| import pandas as pd | |
| import numpy as np | |
| import pandas as pd | |
| import os | |
| import nltk | |
| nltk.download('stopwords') | |
| nltk.download('punkt') | |
| nltk.download('averaged_perceptron_tagger') | |
| import pandas as pd | |
| from collections import Counter | |
| import string | |
| import numpy as np | |
| import re | |
| import pickle | |
| import os | |
| # os.chdir(bert_dir) | |
| from agent.target_extraction.target_extractor import TargetExtractor | |
| #os.chdir('/content/') | |
| from pathos.multiprocessing import ProcessingPool as Pool | |
| import itertools | |
| from time import time | |
| import time | |
| import itertools | |
| import nltk | |
| nltk.download('wordnet') | |
| nltk.download('omw-1.4') | |
| device="cpu" | |
| from gensim.models import word2vec | |
| project_dir='/content' | |
| # # Set a title | |
| # import torch | |
| st.title("Get entity and relations") | |
| # # Add text to the app | |
| uploaded_file = st.file_uploader("Choose a file") | |
| if uploaded_file is not None: | |
| df = pd.read_csv(uploaded_file) | |
| with open(os.path.join("data",uploaded_file.name),"wb") as f: | |
| f.write(uploaded_file.getbuffer() ) | |
| st.write(df) | |
| print(os.path.join("data",uploaded_file.name)) | |
| if(st.button("Submit")): | |
| with st.spinner('Wait for extraction'): | |
| te=TargetExtractor("mobile",os.path.join("data",uploaded_file.name), "reviewText") | |
| te.save_product_representation(project_dir) | |