pentarosarium commited on
Commit
ded1fc2
·
1 Parent(s): ba6d920

add modal token handling

Browse files
Files changed (2) hide show
  1. app.py +11 -0
  2. requirements.txt +3 -1
app.py CHANGED
@@ -1,10 +1,21 @@
1
  import streamlit as st
2
  import pandas as pd
3
  from modal import Function
 
 
 
 
 
 
4
 
5
  def main():
6
  st.title("Financial Statement Analyzer")
7
 
 
 
 
 
 
8
  uploaded_files = st.file_uploader(
9
  "Choose PDF files",
10
  type="pdf",
 
1
  import streamlit as st
2
  import pandas as pd
3
  from modal import Function
4
+ import os
5
+ import modal
6
+
7
+ # Initialize Modal with token
8
+ if 'MODAL_TOKEN' in os.environ:
9
+ modal.config.auth.token = os.environ['MODAL_TOKEN']
10
 
11
  def main():
12
  st.title("Financial Statement Analyzer")
13
 
14
+ # Check Modal token
15
+ if 'MODAL_TOKEN' not in os.environ:
16
+ st.error("Modal token not found. Please add MODAL_TOKEN to Space secrets.")
17
+ return
18
+
19
  uploaded_files = st.file_uploader(
20
  "Choose PDF files",
21
  type="pdf",
requirements.txt CHANGED
@@ -1,3 +1,5 @@
1
  modal>=0.56.4
 
2
  streamlit>=1.32.0
3
- pandas>=2.2.0
 
 
1
  modal>=0.56.4
2
+ modal-client>=0.56.4
3
  streamlit>=1.32.0
4
+ pandas>=2.2.0
5
+ python-dotenv>=1.0.0