Spaces:
Sleeping

stevafernandes commited on
Commit
9b259ed
·
verified ·
1 Parent(s): 535e701

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -25
app.py CHANGED
@@ -72,7 +72,7 @@ def get_conversational_chain(api_key):
72
 
73
  Answer (based only on the context above):
74
  """
75
- model = ChatGoogleGenerativeAI(model="gemini-2.0-flash-exp", temperature=0, google_api_key=api_key)
76
  prompt = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
77
 
78
  chain = prompt | model | StrOutputParser()
@@ -115,8 +115,32 @@ def initialize_vector_store(_api_key):
115
 
116
 
117
  def main():
118
- st.set_page_config(page_title="Chat with PDF", page_icon="📄")
119
- st.header("📄 RAG Chat with PDF")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  st.markdown("Ask questions about the document and get answers based only on its content.")
121
  st.markdown("---")
122
 
@@ -162,31 +186,10 @@ def main():
162
  except Exception as e:
163
  st.error(f"Error getting answer: {str(e)}")
164
 
165
- # Sidebar with info
166
- with st.sidebar:
167
- st.header("About")
168
- st.markdown(
169
- """
170
- This app uses Retrieval Augmented Generation (RAG) to answer
171
- questions based solely on the uploaded PDF document.
172
-
173
- **How it works:**
174
- 1. The PDF is processed and indexed
175
- 2. Your questions are matched against the document content
176
- 3. Answers are generated using only the relevant sections
177
-
178
- **Note:** The AI will not use external knowledge. If information
179
- is not in the document, it will say so.
180
- """
181
- )
182
-
183
- st.markdown("---")
184
- st.markdown(f"**Current Document:** {PDF_FILE_PATH}")
185
-
186
  # Footer
187
  st.markdown("---")
188
  st.markdown(
189
- "<div style='text-align: center'><small>Powered by Gemini 2.0 and LangChain</small></div>",
190
  unsafe_allow_html=True
191
  )
192
 
 
72
 
73
  Answer (based only on the context above):
74
  """
75
+ model = ChatGoogleGenerativeAI(model="gemini-3-flash", temperature=0, google_api_key=api_key)
76
  prompt = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
77
 
78
  chain = prompt | model | StrOutputParser()
 
115
 
116
 
117
  def main():
118
+ st.set_page_config(page_title="Papal Encyclicals RAG", page_icon="📄", layout="centered")
119
+
120
+ # Custom CSS for white background and black text
121
+ st.markdown(
122
+ """
123
+ <style>
124
+ .stApp {
125
+ background-color: white;
126
+ color: black;
127
+ }
128
+ .stMarkdown, .stText, p, span, label, h1, h2, h3 {
129
+ color: black !important;
130
+ }
131
+ .stTextInput > div > div > input {
132
+ color: black;
133
+ background-color: white;
134
+ }
135
+ .stSpinner > div > div {
136
+ color: black;
137
+ }
138
+ </style>
139
+ """,
140
+ unsafe_allow_html=True
141
+ )
142
+
143
+ st.header("Papal Encyclicals RAG")
144
  st.markdown("Ask questions about the document and get answers based only on its content.")
145
  st.markdown("---")
146
 
 
186
  except Exception as e:
187
  st.error(f"Error getting answer: {str(e)}")
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  # Footer
190
  st.markdown("---")
191
  st.markdown(
192
+ "<div style='text-align: center'><small>Powered by Gemini and LangChain</small></div>",
193
  unsafe_allow_html=True
194
  )
195