Spaces:
Runtime error
Runtime error
import streamlit as st | |
from annotated_text import annotated_text | |
from io import StringIO | |
import os | |
os.environ['KMP_DUPLICATE_LIB_OK']='True' | |
import plotly.express as px | |
from streamlit_option_menu import option_menu | |
st. set_page_config(layout="wide") | |
from transformers import pipeline | |
import pandas as pd | |
def init_text_summarization_model(): | |
MODEL = 'facebook/bart-large-cnn' | |
pipe = pipeline("summarization", model=MODEL) | |
return pipe | |
def init_zsl_topic_classification(): | |
MODEL = 'facebook/bart-large-mnli' | |
pipe = pipeline("zero-shot-classification", model=MODEL) | |
template = "This text is about {}." | |
return pipe, template | |
# Model initialization | |
pipeline_summarization = init_text_summarization_model() | |
pipeline_zsl, template = init_zsl_topic_classification() | |
st.header("Intelligent Document Automation") | |
uploaded_file = st.file_uploader("Choose a file") | |
def get_text_from_ocr_engine(uploaded_file): | |
return "This is a sample text for named entity recognition and other tasks" | |
if uploaded_file is not None: | |
ocr_text = get_text_from_ocr_engine(uploaded_file) | |
st.write(ocr_text) | |