Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,50 +0,0 @@
|
|
| 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):
|
| 27 |
-
llm=OpenAI(model_name="text-davinci-003",temperature=0.5)
|
| 28 |
-
response=llm(question)
|
| 29 |
-
return response
|
| 30 |
-
|
| 31 |
-
##initialize our streamlit app
|
| 32 |
-
|
| 33 |
-
st.set_page_config(page_title="Q&A Demo")
|
| 34 |
-
|
| 35 |
-
st.header("Langchain Application")
|
| 36 |
-
|
| 37 |
-
input=st.text_input("Input: ",key="input")
|
| 38 |
-
response=get_openai_response(input)
|
| 39 |
-
|
| 40 |
-
submit=st.button("Ask the question")
|
| 41 |
-
|
| 42 |
-
## If ask button is clicked
|
| 43 |
-
|
| 44 |
-
if submit:
|
| 45 |
-
st.subheader("The Response is")
|
| 46 |
-
st.write(response)
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|