Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,17 +6,6 @@ from transformers import pipeline
|
|
| 6 |
import torch
|
| 7 |
import base64
|
| 8 |
import tempfile
|
| 9 |
-
#import os
|
| 10 |
-
#from dotenv import load_dotenv
|
| 11 |
-
#from huggingface_hub import HfApi
|
| 12 |
-
|
| 13 |
-
#api = HfApi()
|
| 14 |
-
#token = api.retrieve_token("secret_token") # Replace with your secret name
|
| 15 |
-
|
| 16 |
-
#load_dotenv()
|
| 17 |
-
#token = os.environ.get("HF_TOKEN")
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
|
| 22 |
checkpoint = "MBZUAI/LaMini-Flan-T5-248M"
|
|
@@ -51,9 +40,6 @@ def llm_pipeline(filepath):
|
|
| 51 |
result = result[0]['summary_text']
|
| 52 |
return result
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
def main():
|
| 58 |
st.title("Document Summarization App")
|
| 59 |
|
|
@@ -67,8 +53,7 @@ def main():
|
|
| 67 |
temp_file.write(uploaded_file.read())
|
| 68 |
temp_file.flush() # Ensure contents are written to disk
|
| 69 |
filepath = temp_file.name
|
| 70 |
-
|
| 71 |
-
|
| 72 |
try:
|
| 73 |
summary = llm_pipeline(filepath)
|
| 74 |
st.success(summary) # Display only the summary
|
|
|
|
| 6 |
import torch
|
| 7 |
import base64
|
| 8 |
import tempfile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
checkpoint = "MBZUAI/LaMini-Flan-T5-248M"
|
|
|
|
| 40 |
result = result[0]['summary_text']
|
| 41 |
return result
|
| 42 |
|
|
|
|
|
|
|
|
|
|
| 43 |
def main():
|
| 44 |
st.title("Document Summarization App")
|
| 45 |
|
|
|
|
| 53 |
temp_file.write(uploaded_file.read())
|
| 54 |
temp_file.flush() # Ensure contents are written to disk
|
| 55 |
filepath = temp_file.name
|
| 56 |
+
|
|
|
|
| 57 |
try:
|
| 58 |
summary = llm_pipeline(filepath)
|
| 59 |
st.success(summary) # Display only the summary
|