Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ checkpoint = "MBZUAI/LaMini-Flan-T5-248M"
|
|
22 |
#model and tokenizer loading
|
23 |
|
24 |
tokenizer = T5Tokenizer.from_pretrained(checkpoint)
|
25 |
-
base_model = T5ForConditionalGeneration.from_pretrained(checkpoint, device_map='auto', torch_dtype=torch.float32
|
26 |
|
27 |
#file loader and preprocessing
|
28 |
def file_preprocessing(file):
|
@@ -48,7 +48,7 @@ def llm_pipeline(filepath):
|
|
48 |
result = pipe_sum(input_text)
|
49 |
result = result[0]['summary_text']
|
50 |
return result
|
51 |
-
|
52 |
@st.cache_data
|
53 |
#function to display the PDF of a given file
|
54 |
def displayPDF(file):
|
@@ -61,6 +61,7 @@ def displayPDF(file):
|
|
61 |
|
62 |
# Displaying File
|
63 |
st.markdown(pdf_display, unsafe_allow_html=True)
|
|
|
64 |
|
65 |
#streamlit code
|
66 |
st.set_page_config(layout="wide")
|
@@ -79,10 +80,10 @@ def main():
|
|
79 |
temp_file.flush() # Ensure contents are written to disk
|
80 |
filepath = temp_file.name
|
81 |
|
82 |
-
|
83 |
st.info("Uploaded File")
|
84 |
pdf_view = displayPDF(filepath)
|
85 |
-
|
86 |
with col2:
|
87 |
summary = llm_pipeline(filepath)
|
88 |
st.info("Summarization Complete")
|
|
|
22 |
#model and tokenizer loading
|
23 |
|
24 |
tokenizer = T5Tokenizer.from_pretrained(checkpoint)
|
25 |
+
base_model = T5ForConditionalGeneration.from_pretrained(checkpoint, device_map='auto', torch_dtype=torch.float32)
|
26 |
|
27 |
#file loader and preprocessing
|
28 |
def file_preprocessing(file):
|
|
|
48 |
result = pipe_sum(input_text)
|
49 |
result = result[0]['summary_text']
|
50 |
return result
|
51 |
+
"""
|
52 |
@st.cache_data
|
53 |
#function to display the PDF of a given file
|
54 |
def displayPDF(file):
|
|
|
61 |
|
62 |
# Displaying File
|
63 |
st.markdown(pdf_display, unsafe_allow_html=True)
|
64 |
+
"""
|
65 |
|
66 |
#streamlit code
|
67 |
st.set_page_config(layout="wide")
|
|
|
80 |
temp_file.flush() # Ensure contents are written to disk
|
81 |
filepath = temp_file.name
|
82 |
|
83 |
+
""" with col1:
|
84 |
st.info("Uploaded File")
|
85 |
pdf_view = displayPDF(filepath)
|
86 |
+
"""
|
87 |
with col2:
|
88 |
summary = llm_pipeline(filepath)
|
89 |
st.info("Summarization Complete")
|