Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -66,6 +66,30 @@ if not api_key:
|
|
66 |
st.stop()
|
67 |
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
# Function to translate text
|
70 |
def translate_text(text, target_language):
|
71 |
try:
|
@@ -138,30 +162,15 @@ auth = firebase.auth()
|
|
138 |
def initialize_firebase():
|
139 |
try:
|
140 |
if not firebase_admin._apps:
|
141 |
-
|
142 |
-
|
|
|
143 |
firebase_app = initialize_app(cred, {
|
144 |
'databaseURL': os.environ["FIREBASE_DB_URL"]
|
145 |
})
|
146 |
except Exception as e:
|
147 |
st.error(f"Firebase initialization error: {str(e)}")
|
148 |
|
149 |
-
initialize_firebase()
|
150 |
-
|
151 |
-
|
152 |
-
# ----------------- Streamlit Config -------------------
|
153 |
-
st.set_page_config(page_title="ApnaLawyer", layout="centered")
|
154 |
-
|
155 |
-
col1, col2, col3 = st.columns([1, 30, 1])
|
156 |
-
with col2:
|
157 |
-
st.image("images/banner.jpg", use_container_width=True)
|
158 |
-
|
159 |
-
st.markdown("""
|
160 |
-
<style>
|
161 |
-
#MainMenu {visibility: hidden;}
|
162 |
-
footer {visibility: hidden;}
|
163 |
-
</style>
|
164 |
-
""", unsafe_allow_html=True)
|
165 |
|
166 |
# ----------------- Login/Signup Interface -------------------
|
167 |
import json
|
|
|
66 |
st.stop()
|
67 |
|
68 |
|
69 |
+
|
70 |
+
st.error(f"Firebase initialization error: {str(e)}")
|
71 |
+
|
72 |
+
initialize_firebase()
|
73 |
+
|
74 |
+
|
75 |
+
# ----------------- Streamlit Config -------------------
|
76 |
+
st.set_page_config(page_title="ApnaLawyer", layout="centered")
|
77 |
+
|
78 |
+
col1, col2, col3 = st.columns([1, 30, 1])
|
79 |
+
with col2:
|
80 |
+
st.image("images/banner.jpg", use_container_width=True)
|
81 |
+
|
82 |
+
st.markdown("""
|
83 |
+
<style>
|
84 |
+
#MainMenu {visibility: hidden;}
|
85 |
+
footer {visibility: hidden;}
|
86 |
+
</style>
|
87 |
+
""", unsafe_allow_html=True)
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
# Function to translate text
|
94 |
def translate_text(text, target_language):
|
95 |
try:
|
|
|
162 |
def initialize_firebase():
|
163 |
try:
|
164 |
if not firebase_admin._apps:
|
165 |
+
# Load JSON from environment variable
|
166 |
+
creds_dict = json.loads(os.environ["FIREBASE_CREDS_JSON"])
|
167 |
+
cred = credentials.Certificate(creds_dict)
|
168 |
firebase_app = initialize_app(cred, {
|
169 |
'databaseURL': os.environ["FIREBASE_DB_URL"]
|
170 |
})
|
171 |
except Exception as e:
|
172 |
st.error(f"Firebase initialization error: {str(e)}")
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
# ----------------- Login/Signup Interface -------------------
|
176 |
import json
|