Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,26 @@
|
|
| 1 |
-
#
|
| 2 |
-
from langchain.llms import OpenAI
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
#load_dotenv() # take environment variables from .env.
|
| 7 |
|
| 8 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
import os
|
| 10 |
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
## Function to load OpenAI model and get respones
|
| 13 |
|
| 14 |
def get_openai_response(question):
|
|
|
|
| 1 |
+
# Multiple PDF
|
|
|
|
| 2 |
|
| 3 |
+
|
|
|
|
|
|
|
| 4 |
|
| 5 |
import streamlit as st
|
| 6 |
+
from PyPDF2 import Pdfreader
|
| 7 |
+
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 8 |
+
|
| 9 |
+
from langchain_google_genai import GoogleGenerativeAIEmbennings
|
| 10 |
import os
|
| 11 |
|
| 12 |
|
| 13 |
+
import google.generativeai as genai
|
| 14 |
+
|
| 15 |
+
from langchain.vectorstores import FAISS
|
| 16 |
+
from langchain.google_genai import ChatGoogleGenerativeAI
|
| 17 |
+
from langchain.chains.question_answering import load_qa_chain
|
| 18 |
+
from langchain.prompts import PromptTemplate
|
| 19 |
+
from dotenv import load_dotenv
|
| 20 |
+
|
| 21 |
+
genai.configure(api_key = os.getenv("")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
## Function to load OpenAI model and get respones
|
| 25 |
|
| 26 |
def get_openai_response(question):
|