Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -86,7 +86,8 @@ def rag(input_text, file):
|
|
86 |
# documents = []
|
87 |
# for f in file:
|
88 |
# documents += SimpleDirectoryReader(f).load_data()
|
89 |
-
|
|
|
90 |
index = VectorStoreIndex.from_documents(documents)
|
91 |
# collection.add(
|
92 |
# documents=documents,
|
@@ -96,7 +97,7 @@ def rag(input_text, file):
|
|
96 |
query_engine = index.as_query_engine()
|
97 |
return query_engine.query(
|
98 |
input_text
|
99 |
-
)
|
100 |
|
101 |
iface = gr.Interface(fn=rag, inputs=[gr.Textbox(label="Pitanje:", lines=6), gr.File()],
|
102 |
outputs=[gr.Textbox(label="Odgovor:", lines=6)],
|
|
|
86 |
# documents = []
|
87 |
# for f in file:
|
88 |
# documents += SimpleDirectoryReader(f).load_data()
|
89 |
+
f = file + "*.pdf"
|
90 |
+
documents = SimpleDirectoryReader(f).load_data()
|
91 |
index = VectorStoreIndex.from_documents(documents)
|
92 |
# collection.add(
|
93 |
# documents=documents,
|
|
|
97 |
query_engine = index.as_query_engine()
|
98 |
return query_engine.query(
|
99 |
input_text
|
100 |
+
) +
|
101 |
|
102 |
iface = gr.Interface(fn=rag, inputs=[gr.Textbox(label="Pitanje:", lines=6), gr.File()],
|
103 |
outputs=[gr.Textbox(label="Odgovor:", lines=6)],
|