Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from langchain.document_loaders import PyPDFLoader
|
|
|
|
| 3 |
#from langchain.document_loaders import UnstructuredPDFLoader
|
| 4 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 5 |
#from langchain.text_splitter import CharacterTextSplitter
|
| 6 |
from langchain.vectorstores import Pinecone
|
| 7 |
import pinecone
|
| 8 |
import requests
|
| 9 |
-
#from langchain.prompts.chat import (ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate)
|
| 10 |
from langchain.chains.question_answering import load_qa_chain
|
| 11 |
from langchain import PromptTemplate
|
| 12 |
from langchain import HuggingFaceHub
|
| 13 |
from PyPDF2 import PdfReader
|
| 14 |
-
#from langchain.document_loaders import TextLoader
|
| 15 |
-
#from sentence_transformers.util import semantic_search
|
| 16 |
-
#import pandas as pd
|
| 17 |
-
#import torch
|
| 18 |
from pathlib import Path
|
| 19 |
from time import sleep
|
| 20 |
import sys
|
|
@@ -23,6 +19,9 @@ import random
|
|
| 23 |
import string
|
| 24 |
from dotenv import load_dotenv
|
| 25 |
load_dotenv()
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
def generate_random_string(length):
|
| 28 |
letters = string.ascii_lowercase
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from langchain.document_loaders import PyPDFLoader
|
| 3 |
+
#from langchain.document_loaders import TextLoader
|
| 4 |
#from langchain.document_loaders import UnstructuredPDFLoader
|
| 5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 6 |
#from langchain.text_splitter import CharacterTextSplitter
|
| 7 |
from langchain.vectorstores import Pinecone
|
| 8 |
import pinecone
|
| 9 |
import requests
|
|
|
|
| 10 |
from langchain.chains.question_answering import load_qa_chain
|
| 11 |
from langchain import PromptTemplate
|
| 12 |
from langchain import HuggingFaceHub
|
| 13 |
from PyPDF2 import PdfReader
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
from pathlib import Path
|
| 15 |
from time import sleep
|
| 16 |
import sys
|
|
|
|
| 19 |
import string
|
| 20 |
from dotenv import load_dotenv
|
| 21 |
load_dotenv()
|
| 22 |
+
#from sentence_transformers.util import semantic_search
|
| 23 |
+
#import pandas as pd
|
| 24 |
+
#import torch
|
| 25 |
|
| 26 |
def generate_random_string(length):
|
| 27 |
letters = string.ascii_lowercase
|