Spaces:
Runtime error
Runtime error
Commit
·
ba3fc08
1
Parent(s):
a94bd5e
Update app.py
Browse files
app.py
CHANGED
@@ -4,16 +4,14 @@ from langchain.docstore.document import Document
|
|
4 |
from langchain.embeddings import HuggingFaceEmbeddings
|
5 |
from langchain.text_splitter import CharacterTextSplitter
|
6 |
embeddings = HuggingFaceEmbeddings()
|
7 |
-
|
8 |
-
|
9 |
-
gita="story of Arjun and Krishna refered to as song celestial"
|
10 |
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
|
11 |
texts = text_splitter.split_text(gita)
|
12 |
docsearch = Chroma.from_texts(texts, embeddings)
|
13 |
def answer(query):
|
14 |
docs = docsearch.similarity_search(query)
|
15 |
out=docs[0].page_content
|
16 |
-
#out=gita
|
17 |
return out
|
18 |
demo = gr.Interface(fn=answer, inputs='text',outputs='text',examples=[['song celestial']])
|
19 |
demo.launch()
|
|
|
4 |
from langchain.embeddings import HuggingFaceEmbeddings
|
5 |
from langchain.text_splitter import CharacterTextSplitter
|
6 |
embeddings = HuggingFaceEmbeddings()
|
7 |
+
g=open('gita.txt')
|
8 |
+
gita=g.read()
|
|
|
9 |
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
|
10 |
texts = text_splitter.split_text(gita)
|
11 |
docsearch = Chroma.from_texts(texts, embeddings)
|
12 |
def answer(query):
|
13 |
docs = docsearch.similarity_search(query)
|
14 |
out=docs[0].page_content
|
|
|
15 |
return out
|
16 |
demo = gr.Interface(fn=answer, inputs='text',outputs='text',examples=[['song celestial']])
|
17 |
demo.launch()
|