Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import pandas as pd | |
| import tiktoken | |
| import pandas as pd | |
| import time | |
| import spacy | |
| from spacy.lang.en.stop_words import STOP_WORDS | |
| from string import punctuation | |
| from collections import Counter | |
| from heapq import nlargest | |
| import nltk | |
| import numpy as np | |
| from tqdm import tqdm | |
| from sentence_transformers import SentenceTransformer, util | |
| from sentence_transformers import SentenceTransformer, CrossEncoder, util | |
| import gzip | |
| import os | |
| import torch | |
| import re | |
| import openai | |
| from openai.embeddings_utils import get_embedding, cosine_similarity | |
| import os | |
| # load_dotenv() | |
| # print(os.getcwd()) | |
| # openai.api_key = os.environ['OPENAI_KEY'] | |
| df = pd.read_pickle('entire_data.pkl') #to load 123.pkl back to the dataframe df | |
| # model = SentenceTransformer('all-mpnet-base-v2') | |
| # def remove_html_tags(text): | |
| # clean = re.compile('<.*?>') | |
| # return re.sub(clean, '', text) | |
| # df['content'] = df.content.apply(lambda x: remove_html_tags(x)) | |
| # df['summary_html'] = df.summary_html.apply(lambda x: remove_html_tags(x)) | |
| # session_prompt = """ A bot that is open to discussions about different cultural, philosophical and political exchanges. I will use do different analysis to the articles provided to me. Stay truthful and if you weren't provided any resources give your oppinion only.""" | |