Spaces:
Runtime error
Runtime error
File size: 1,329 Bytes
0b1042e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# 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)
|