Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ from PIL import Image
|
|
4 |
import easyocr
|
5 |
from transformers import pipeline
|
6 |
|
7 |
-
# Create a text2text-generation pipeline with the "
|
8 |
-
pipe = pipeline("text2text-generation", model="
|
9 |
|
10 |
# Initialize the EasyOCR reader for text extraction from images
|
11 |
ocr_reader = easyocr.Reader(['en'])
|
@@ -26,7 +26,7 @@ if uploaded_file is not None:
|
|
26 |
|
27 |
if extracted_text:
|
28 |
# Use the pipeline to generate a concise explanation
|
29 |
-
explanation = pipe(extracted_text, max_length=
|
30 |
st.markdown("**Explanation (5-6 lines):**")
|
31 |
st.markdown(explanation)
|
32 |
else:
|
|
|
4 |
import easyocr
|
5 |
from transformers import pipeline
|
6 |
|
7 |
+
# Create a text2text-generation pipeline with the "t5-small" model
|
8 |
+
pipe = pipeline("text2text-generation", model="t5-small")
|
9 |
|
10 |
# Initialize the EasyOCR reader for text extraction from images
|
11 |
ocr_reader = easyocr.Reader(['en'])
|
|
|
26 |
|
27 |
if extracted_text:
|
28 |
# Use the pipeline to generate a concise explanation
|
29 |
+
explanation = pipe(extracted_text, max_length=150, do_sample=True)[0]["generated_text"]
|
30 |
st.markdown("**Explanation (5-6 lines):**")
|
31 |
st.markdown(explanation)
|
32 |
else:
|