Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,33 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def get_response_from_query(db, query, k=3):
|
4 |
|
5 |
-
|
6 |
docs = db.similarity_search(query, k=k)
|
7 |
|
8 |
docs_page_content = " ".join([d.page_content for d in docs])
|
|
|
1 |
import gradio as gr
|
2 |
+
import sentence_transformers openai unstructured
|
3 |
+
import plotly
|
4 |
+
import langchain
|
5 |
+
import tiktoken
|
6 |
+
import matplotlib
|
7 |
+
import pickle
|
8 |
+
import linkify-it-py
|
9 |
+
|
10 |
+
import numpy as np
|
11 |
+
import os, random
|
12 |
+
from pathlib import Path
|
13 |
+
import tiktoken
|
14 |
+
from getpass import getpass
|
15 |
+
from rich.markdown import Markdown
|
16 |
+
from langchain.chains.qa_with_sources import load_qa_with_sources_chain
|
17 |
+
|
18 |
+
import torch
|
19 |
+
import sys
|
20 |
+
import csv
|
21 |
+
|
22 |
+
from langchain_openai import OpenAIEmbeddings
|
23 |
+
from langchain_openai import ChatOpenAI
|
24 |
+
|
25 |
+
# Load the FAISS index from the .pkl file
|
26 |
+
with open("index.pkl", "rb") as f:
|
27 |
+
db_loaded = pickle.load(f)
|
28 |
|
29 |
def get_response_from_query(db, query, k=3):
|
30 |
|
|
|
31 |
docs = db.similarity_search(query, k=k)
|
32 |
|
33 |
docs_page_content = " ".join([d.page_content for d in docs])
|