Sasidhar commited on
Commit
826b6f7
·
1 Parent(s): d6bb012

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -26,6 +26,13 @@ def init_zsl_topic_classification():
26
  template = "This text is about {}."
27
  return pipe, template
28
 
 
 
 
 
 
 
 
29
  # Model initialization
30
  pipeline_summarization = init_text_summarization_model()
31
  pipeline_zsl, template = init_zsl_topic_classification()
@@ -37,8 +44,13 @@ uploaded_file = st.file_uploader("Choose a file")
37
  def get_text_from_ocr_engine(uploaded_file):
38
  return "This is a sample text for named entity recognition and other tasks"
39
 
 
 
 
 
40
 
41
- if uploaded_file is not None:
42
- ocr_text = get_text_from_ocr_engine(uploaded_file)
43
- st.write(ocr_text)
44
-
 
 
26
  template = "This text is about {}."
27
  return pipe, template
28
 
29
+ @st.cache(allow_output_mutation = True)
30
+ def init_zsl_topic_classification():
31
+ MODEL = 'facebook/bart-large-mnli'
32
+ pipe = pipeline("zero-shot-classification", model=MODEL)
33
+ template = "This text is about {}."
34
+ return pipe, template
35
+
36
  # Model initialization
37
  pipeline_summarization = init_text_summarization_model()
38
  pipeline_zsl, template = init_zsl_topic_classification()
 
44
  def get_text_from_ocr_engine(uploaded_file):
45
  return "This is a sample text for named entity recognition and other tasks"
46
 
47
+ with st.sidebar:
48
+ selected_menu = option_menu("Select Option", ["Upload Document", "Extract Text", "Summarize Document", "Extract Entities","Get Answers "],
49
+ menu_icon="cast", default_index=1)
50
+
51
 
52
+ if selected_menu == "Upload Document":
53
+ if uploaded_file is not None:
54
+ ocr_text = get_text_from_ocr_engine(uploaded_file)
55
+ st.write("Upload Successful")
56
+