TabasumDev commited on
Commit
838eb5c
Β·
verified Β·
1 Parent(s): 8c156f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -270,7 +270,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
270
  from PyPDF2 import PdfReader
271
  from peft import get_peft_model, LoraConfig, TaskType
272
 
273
- # βœ… Force CPU execution for Hugging Face Spaces
274
  device = torch.device("cpu")
275
 
276
  # πŸ”Ή Load IBM Granite Model (CPU-Compatible)
@@ -370,7 +370,9 @@ def main():
370
  # πŸ”Ή File Upload Section
371
  uploaded_file = st.file_uploader("πŸ“‚ Upload a contract document (PDF)", type="pdf")
372
 
373
- if uploaded_file:
 
 
374
  st.success("βœ… File uploaded successfully!")
375
  st.write("Click the button below to analyze the contract.")
376
 
@@ -393,3 +395,4 @@ if __name__ == '__main__':
393
  main()
394
 
395
 
 
 
270
  from PyPDF2 import PdfReader
271
  from peft import get_peft_model, LoraConfig, TaskType
272
 
273
+ # βœ… Force CPU execution
274
  device = torch.device("cpu")
275
 
276
  # πŸ”Ή Load IBM Granite Model (CPU-Compatible)
 
370
  # πŸ”Ή File Upload Section
371
  uploaded_file = st.file_uploader("πŸ“‚ Upload a contract document (PDF)", type="pdf")
372
 
373
+ # βœ… Ensure file upload message is displayed
374
+ if uploaded_file is not None:
375
+ st.session_state["uploaded_file"] = uploaded_file # Persist file in session state
376
  st.success("βœ… File uploaded successfully!")
377
  st.write("Click the button below to analyze the contract.")
378
 
 
395
  main()
396
 
397
 
398
+