Spaces:
Running
Running
Defkhan5960
commited on
Commit
•
f1acf55
1
Parent(s):
a05002d
Update app.py
Browse files
app.py
CHANGED
@@ -42,15 +42,32 @@ def get_vector_store(text_chunks):
|
|
42 |
def get_conversational_chain():
|
43 |
|
44 |
prompt_template = """
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
Answer:
|
50 |
"""
|
51 |
|
52 |
model = ChatGoogleGenerativeAI(model="gemini-pro",
|
53 |
-
temperature=0.
|
54 |
|
55 |
prompt = PromptTemplate(template = prompt_template, input_variables = ["context", "question"])
|
56 |
chain = load_qa_chain(model, chain_type="stuff", prompt=prompt)
|
@@ -88,10 +105,14 @@ def main():
|
|
88 |
user_input(user_question)
|
89 |
|
90 |
with st.sidebar:
|
|
|
|
|
|
|
|
|
|
|
91 |
st.image("img.jpg")
|
92 |
st.write("---")
|
93 |
|
94 |
-
st.title("Menu:")
|
95 |
pdf_docs = st.file_uploader("Upload your PDF Files and Click on the Submit & Process Button", accept_multiple_files=True)
|
96 |
if st.button("Submit & Process"):
|
97 |
with st.spinner("Processing..."):
|
|
|
42 |
def get_conversational_chain():
|
43 |
|
44 |
prompt_template = """
|
45 |
+
Use the following pieces of information to answer the user's question.\n\n
|
46 |
+
|
47 |
+
Context: answer as long and as detailed as you can. Make specific points. {context}?
|
48 |
+
Question: {question}?
|
49 |
+
|
50 |
+
You are a helper chatbot. You answer people's questions. You have knowledge about everything in general.
|
51 |
+
|
52 |
+
If you can't find information in the PDF, use your own knowledge to answer questions that are indirectly related to the PDF.
|
53 |
+
However, make sure to connect your answers to the PDF's content, even when using external knowledge.
|
54 |
+
|
55 |
+
Try your best to give the answer.
|
56 |
+
Also try to add some your own wordings the describe the answer.
|
57 |
+
|
58 |
+
Never Answer Like : "I don't know" ,
|
59 |
+
"The provided document does not contain information",
|
60 |
+
"Bu sorunun cevabı verilen metinde bulunmamaktadır",
|
61 |
+
"Metinde .... ilgili herhangi bir bilgi verilmemiştir.",
|
62 |
+
".... hakkında bilgi verilmemiştir.",
|
63 |
+
|
64 |
+
Helpful Answer:
|
65 |
+
|
66 |
|
|
|
67 |
"""
|
68 |
|
69 |
model = ChatGoogleGenerativeAI(model="gemini-pro",
|
70 |
+
temperature=0.4)
|
71 |
|
72 |
prompt = PromptTemplate(template = prompt_template, input_variables = ["context", "question"])
|
73 |
chain = load_qa_chain(model, chain_type="stuff", prompt=prompt)
|
|
|
105 |
user_input(user_question)
|
106 |
|
107 |
with st.sidebar:
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
st.audio("music.mp3", format='audio/mp3')
|
112 |
+
|
113 |
st.image("img.jpg")
|
114 |
st.write("---")
|
115 |
|
|
|
116 |
pdf_docs = st.file_uploader("Upload your PDF Files and Click on the Submit & Process Button", accept_multiple_files=True)
|
117 |
if st.button("Submit & Process"):
|
118 |
with st.spinner("Processing..."):
|