Update app.py
Browse files
app.py
CHANGED
|
@@ -82,29 +82,26 @@ def bansum(text):
|
|
| 82 |
if isinstance(out, list) and out[0].get("summary_text"):
|
| 83 |
text_output = out[0]["summary_text"]
|
| 84 |
st.success(text_output)
|
| 85 |
-
if "photo" not in st.session_state:
|
| 86 |
-
st.session_state["photo"]="not done"
|
| 87 |
-
def change_photo_state():
|
| 88 |
-
st.session_state["photo"]="done"
|
| 89 |
-
|
| 90 |
-
c1, c2, c3 = st.columns([2,2,1])
|
| 91 |
-
@st.experimental_singleton
|
| 92 |
-
def save():
|
| 93 |
-
camera_photo = c2.camera_input("Capture a photo to summarize: ", on_change=change_photo_state)
|
| 94 |
-
return camera_photo
|
| 95 |
|
| 96 |
#@st.cache
|
| 97 |
def main():
|
| 98 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
if st.checkbox("Summarize from text/images/pdfs"):
|
| 100 |
with st.container():
|
| 101 |
message = c1.text_input("Type your text here!")
|
| 102 |
if c2.button("CaptureImage"):
|
| 103 |
-
camera_photo=
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
| 108 |
if st.session_state["photo"]=="done" or message:
|
| 109 |
if uploaded_photo and uploaded_photo.type=='application/pdf':
|
| 110 |
tet = read_pdf(uploaded_photo)
|
|
|
|
| 82 |
if isinstance(out, list) and out[0].get("summary_text"):
|
| 83 |
text_output = out[0]["summary_text"]
|
| 84 |
st.success(text_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
#@st.cache
|
| 87 |
def main():
|
| 88 |
import streamlit as st
|
| 89 |
+
import time
|
| 90 |
+
if "photo" not in st.session_state:
|
| 91 |
+
st.session_state["photo"]="not done"
|
| 92 |
+
def change_photo_state():
|
| 93 |
+
st.session_state["photo"]="done"
|
| 94 |
+
c1, c2, c3 = st.columns([2,2,1])
|
| 95 |
if st.checkbox("Summarize from text/images/pdfs"):
|
| 96 |
with st.container():
|
| 97 |
message = c1.text_input("Type your text here!")
|
| 98 |
if c2.button("CaptureImage"):
|
| 99 |
+
camera_photo = c2.camera_input("Capture a photo to summarize: ", on_change=change_photo_state)
|
| 100 |
+
if c2.button("Stop camera"):
|
| 101 |
+
CaptureImage =False
|
| 102 |
+
if c3.button("Upload Images/PDFs"):
|
| 103 |
+
uploaded_photo = c3.file_uploader("Upload your Images/PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
| 104 |
+
time.sleep(3)
|
| 105 |
if st.session_state["photo"]=="done" or message:
|
| 106 |
if uploaded_photo and uploaded_photo.type=='application/pdf':
|
| 107 |
tet = read_pdf(uploaded_photo)
|