Update app.py
Browse files
app.py
CHANGED
|
@@ -59,19 +59,20 @@ def engsum(output):
|
|
| 59 |
out = query({
|
| 60 |
"inputs": output,
|
| 61 |
})
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 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 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
|
| 74 |
-
st.title("
|
|
|
|
| 75 |
#@st.cache_resource(experimental_allow_widgets=True)
|
| 76 |
def main():
|
| 77 |
#global tokenizer, model
|
|
@@ -85,7 +86,6 @@ def main():
|
|
| 85 |
""")
|
| 86 |
def change_photo_state():
|
| 87 |
st.session_state["photo"]="done"
|
| 88 |
-
st.subheader("Please, feed your pdf/images/text, features/services will appear automatically!")
|
| 89 |
message = st.text_input("Type your text here!")
|
| 90 |
uploaded_photo = st.sidebar.file_uploader("Upload your Images/PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
| 91 |
camera_photo = st.sidebar.camera_input("Take a photo, Containing English texts", on_change=change_photo_state)
|
|
@@ -128,11 +128,11 @@ def main():
|
|
| 128 |
engsum(text)
|
| 129 |
elif uploaded_photo==None and camera_photo==None:
|
| 130 |
text = message
|
| 131 |
-
if st.button("
|
| 132 |
bansum(text)
|
| 133 |
-
if st.button("
|
| 134 |
engsum(text)
|
| 135 |
-
if st.
|
| 136 |
def query(payload):
|
| 137 |
response = requests.post(API_URL2, headers=headers2, json=payload)
|
| 138 |
return response.json()
|
|
|
|
| 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("summary_text"):
|
| 71 |
+
text_output = out[0]["summary_text"]
|
| 72 |
+
st.success(text_output)
|
| 73 |
|
| 74 |
+
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
|
|
|
|
| 86 |
""")
|
| 87 |
def change_photo_state():
|
| 88 |
st.session_state["photo"]="done"
|
|
|
|
| 89 |
message = st.text_input("Type your text here!")
|
| 90 |
uploaded_photo = st.sidebar.file_uploader("Upload your Images/PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
| 91 |
camera_photo = st.sidebar.camera_input("Take a photo, Containing English texts", on_change=change_photo_state)
|
|
|
|
| 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()
|