Soumen commited on
Commit
a811191
1 Parent(s): d0a45f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -59,17 +59,17 @@ def engsum(output):
59
  out = query({
60
  "inputs": output,
61
  })
62
- if isinstance(out, list) and out[0].get("generated_text"):
63
- text_output = out[0]["generated_text"]
64
- st.success(text_output)
65
  def bansum(text):
66
  def query(payload):
67
  response = requests.post(API_URL0, headers=headers0, json=payload)
68
  return response.json()
69
  out = query({"inputs": text})
70
- if isinstance(out, list) and out[0].get("generated_text"):
71
- text_output = out[0]["generated_text"]
72
- st.success(text_output)
73
 
74
  st.title("NLP APPLICATION")
75
  #@st.cache_resource(experimental_allow_widgets=True)
@@ -106,11 +106,11 @@ def main():
106
  img = Image.open(uploaded_photo)
107
  img = img.save("img.png")
108
  img = cv2.imread("img.png")
109
- st.text("Press the content type:")
110
- if st.button("Content Type: Bangla"):
111
  text = pytesseract.image_to_string(img, lang="ben")
112
  bansum(text)
113
- if st.button("Content Type: English"):
114
  text=pytesseract.image_to_string(img)
115
  engsum(text)
116
  #st.success(text)
@@ -119,11 +119,11 @@ def main():
119
  img = img.save("img.png")
120
  img = cv2.imread("img.png")
121
  #text = pytesseract.image_to_string(img) if st.checkbox("Bangla") else pytesseract.image_to_string(img, lang="ben")
122
- st.text("Please select the content type for summarization:")
123
- if st.button("Content Type: Bangla"):
124
  text = pytesseract.image_to_string(img, lang="ben")
125
  bansum(text)
126
- if st.button("Content Type: English"):
127
  text=pytesseract.image_to_string(img)
128
  engsum(text)
129
  elif uploaded_photo==None and camera_photo==None:
 
59
  out = query({
60
  "inputs": output,
61
  })
62
+ #if isinstance(out, list) and out[0].get("generated_text"):
63
+ #text_output = out[0]["generated_text"]
64
+ st.success(out)
65
  def bansum(text):
66
  def query(payload):
67
  response = requests.post(API_URL0, headers=headers0, json=payload)
68
  return response.json()
69
  out = query({"inputs": text})
70
+ #if isinstance(out, list) and out[0].get("generated_text"):
71
+ #text_output = out[0]["generated_text"]
72
+ st.success(out)
73
 
74
  st.title("NLP APPLICATION")
75
  #@st.cache_resource(experimental_allow_widgets=True)
 
106
  img = Image.open(uploaded_photo)
107
  img = img.save("img.png")
108
  img = cv2.imread("img.png")
109
+ st.text("Select the summarization type:")
110
+ if st.button("Bangla"):
111
  text = pytesseract.image_to_string(img, lang="ben")
112
  bansum(text)
113
+ if st.button("English"):
114
  text=pytesseract.image_to_string(img)
115
  engsum(text)
116
  #st.success(text)
 
119
  img = img.save("img.png")
120
  img = cv2.imread("img.png")
121
  #text = pytesseract.image_to_string(img) if st.checkbox("Bangla") else pytesseract.image_to_string(img, lang="ben")
122
+ st.text("Select the summarization type:")
123
+ if st.button("Bangla"):
124
  text = pytesseract.image_to_string(img, lang="ben")
125
  bansum(text)
126
+ if st.button("English"):
127
  text=pytesseract.image_to_string(img)
128
  engsum(text)
129
  elif uploaded_photo==None and camera_photo==None: