Soumen commited on
Commit
b0e2f8f
·
1 Parent(s): 0975d28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -20
app.py CHANGED
@@ -75,15 +75,7 @@ st.title("Bangla and English Summarizer:")
75
  st.subheader("Please, Upload your PDF/Images or write texts to see the summarize options: ")
76
  #@st.cache_resource(experimental_allow_widgets=True)
77
  def main():
78
- #global tokenizer, model
79
- #tokenizer = AutoTokenizer.from_pretrained('t5-base')
80
- #model = AutoModelWithLMHead.from_pretrained('t5-base', return_dict=True)
81
  """ NLP Based Application with Streamlit """
82
- st.markdown("""
83
- #### Description
84
- ##This is a Natural Language Processing(NLP) base Application that is useful for basic NLP tasks such as follows:
85
- PDF Document/Image's Text Summarization.
86
- """)
87
  def change_photo_state():
88
  st.session_state["photo"]="done"
89
  message = st.text_input("Type your text here!")
@@ -126,24 +118,24 @@ def main():
126
  if st.button("English"):
127
  text=pytesseract.image_to_string(img)
128
  engsum(text)
129
- elif uploaded_photo==None and camera_photo==None:
130
  text = message
131
  if st.button("Bangla"):
132
  bansum(text)
133
  if st.button("English"):
134
  engsum(text)
135
- if st.button("English Text Generation"):
136
- def query(payload):
137
- response = requests.post(API_URL2, headers=headers2, json=payload)
138
- return response.json()
139
 
140
- out = query({
141
- "inputs": text,
142
- })
143
- if isinstance(out, list) and out[0].get("generated_text"):
144
- text_output = out[0]["generated_text"]
145
- st.success(text_output)
146
- #text=text_output
147
 
148
  if __name__ == '__main__':
149
  main()
 
75
  st.subheader("Please, Upload your PDF/Images or write texts to see the summarize options: ")
76
  #@st.cache_resource(experimental_allow_widgets=True)
77
  def main():
 
 
 
78
  """ NLP Based Application with Streamlit """
 
 
 
 
 
79
  def change_photo_state():
80
  st.session_state["photo"]="done"
81
  message = st.text_input("Type your text here!")
 
118
  if st.button("English"):
119
  text=pytesseract.image_to_string(img)
120
  engsum(text)
121
+ elif:
122
  text = message
123
  if st.button("Bangla"):
124
  bansum(text)
125
  if st.button("English"):
126
  engsum(text)
127
+ # if st.button("English Text Generation"):
128
+ # def query(payload):
129
+ # response = requests.post(API_URL2, headers=headers2, json=payload)
130
+ # return response.json()
131
 
132
+ # out = query({
133
+ # "inputs": text,
134
+ # })
135
+ # if isinstance(out, list) and out[0].get("generated_text"):
136
+ # text_output = out[0]["generated_text"]
137
+ # st.success(text_output)
138
+ # #text=text_output
139
 
140
  if __name__ == '__main__':
141
  main()