Vlad Bastina commited on
Commit
d2c8d11
·
1 Parent(s): 7fc2127
Files changed (2) hide show
  1. app.py +14 -0
  2. style.css +0 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
2
  import os
3
  import re
4
  from query_chat import GeminiQanA
 
5
 
6
  def extract_text_from_txt(file_path):
7
  # In a real scenario, handle FileNotFoundError
@@ -12,6 +13,19 @@ def extract_text_from_txt(file_path):
12
  st.warning(f"File not found: {file_path}. Using placeholder text.")
13
  return f"Placeholder text for {os.path.basename(file_path)}"
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  @st.cache_resource()
17
  def load_chatbot():
 
2
  import os
3
  import re
4
  from query_chat import GeminiQanA
5
+ from pathlib import Path
6
 
7
  def extract_text_from_txt(file_path):
8
  # In a real scenario, handle FileNotFoundError
 
13
  st.warning(f"File not found: {file_path}. Using placeholder text.")
14
  return f"Placeholder text for {os.path.basename(file_path)}"
15
 
16
+ def load_css(file_name):
17
+ """Loads a CSS file and injects it into the Streamlit app."""
18
+ try:
19
+ css_path = Path(__file__).parent / file_name
20
+ with open(css_path) as f:
21
+ st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
22
+ # st.info(f"Loaded CSS: {file_name}") # Optional: uncomment for debugging
23
+ except FileNotFoundError:
24
+ st.error(f"CSS file not found: {file_name}. Make sure it's in the same directory as app.py.")
25
+ except Exception as e:
26
+ st.error(f"Error loading CSS file {file_name}: {e}")
27
+
28
+ load_css("style.css")
29
 
30
  @st.cache_resource()
31
  def load_chatbot():
style.css ADDED
File without changes