Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,55 +1,55 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import llm
|
| 3 |
-
from file_creator import Create_Doc
|
| 4 |
-
|
| 5 |
-
model = llm.Model()
|
| 6 |
-
unvalid_image_text = 'please upload a valid screenshot.'
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
st.markdown("""
|
| 10 |
-
<style>
|
| 11 |
-
.justified-text {
|
| 12 |
-
text-align: justify;
|
| 13 |
-
}
|
| 14 |
-
</style>
|
| 15 |
-
""", unsafe_allow_html=True)
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
with st.sidebar:
|
| 19 |
-
st.header("ABOUT:")
|
| 20 |
-
|
| 21 |
-
st.caption("""
|
| 22 |
-
<div class="justified-text">
|
| 23 |
-
|
| 24 |
-
</div>
|
| 25 |
-
""", unsafe_allow_html=True)
|
| 26 |
-
|
| 27 |
-
for _ in range(17):
|
| 28 |
-
st.write("")
|
| 29 |
-
st.subheader("Build By:")
|
| 30 |
-
st.write("[Pachaiappan❤️](https://mr-vicky-01.github.io/Portfolio)")
|
| 31 |
-
st.write("contact: [Email](mailto:pachaiappan1102@gamil.com)")
|
| 32 |
-
|
| 33 |
-
st.title("
|
| 34 |
-
st.text("
|
| 35 |
-
uploaded_file = st.file_uploader("", type=["png", "jpg", "jpeg"])
|
| 36 |
-
|
| 37 |
-
if uploaded_file:
|
| 38 |
-
st.image(uploaded_file)
|
| 39 |
-
|
| 40 |
-
button = st.button("Generate Document")
|
| 41 |
-
if button:
|
| 42 |
-
with st.spinner("Generating
|
| 43 |
-
text = model.get_response(uploaded_file)
|
| 44 |
-
st.write(text)
|
| 45 |
-
|
| 46 |
-
if text.lower().strip() != unvalid_image_text:
|
| 47 |
-
doc = Create_Doc()
|
| 48 |
-
doc_buffer = doc.markdown_to_word(text)
|
| 49 |
-
st.download_button(
|
| 50 |
-
label="Download",
|
| 51 |
-
data=doc_buffer,
|
| 52 |
-
file_name="output.docx",
|
| 53 |
-
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
| 54 |
-
)
|
| 55 |
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import llm
|
| 3 |
+
from file_creator import Create_Doc
|
| 4 |
+
|
| 5 |
+
model = llm.Model()
|
| 6 |
+
unvalid_image_text = 'please upload a valid screenshot.'
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
st.markdown("""
|
| 10 |
+
<style>
|
| 11 |
+
.justified-text {
|
| 12 |
+
text-align: justify;
|
| 13 |
+
}
|
| 14 |
+
</style>
|
| 15 |
+
""", unsafe_allow_html=True)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
with st.sidebar:
|
| 19 |
+
st.header("ABOUT:")
|
| 20 |
+
|
| 21 |
+
st.caption("""
|
| 22 |
+
<div class="justified-text">
|
| 23 |
+
Screenshot to Document file Creator is an AI powered app that allows users to effortlessly convert their screenshots into Word documents. Simply upload a screenshot, and the app will generate a Word document based on the image provided, ensuring a seamless and efficient conversion process. Ideal for anyone looking to quickly turn visual content into editable text documents.
|
| 24 |
+
</div>
|
| 25 |
+
""", unsafe_allow_html=True)
|
| 26 |
+
|
| 27 |
+
for _ in range(17):
|
| 28 |
+
st.write("")
|
| 29 |
+
st.subheader("Build By:")
|
| 30 |
+
st.write("[Pachaiappan❤️](https://mr-vicky-01.github.io/Portfolio)")
|
| 31 |
+
st.write("contact: [Email](mailto:pachaiappan1102@gamil.com)")
|
| 32 |
+
|
| 33 |
+
st.title("Image🖼️ - DOCUMENT📃")
|
| 34 |
+
st.text("Upload your screenshot to convert it into a Word document.")
|
| 35 |
+
uploaded_file = st.file_uploader("", type=["png", "jpg", "jpeg"])
|
| 36 |
+
|
| 37 |
+
if uploaded_file:
|
| 38 |
+
st.image(uploaded_file)
|
| 39 |
+
|
| 40 |
+
button = st.button("Generate Document")
|
| 41 |
+
if button:
|
| 42 |
+
with st.spinner("🤖Generating your Document..."):
|
| 43 |
+
text = model.get_response(uploaded_file)
|
| 44 |
+
st.write(text)
|
| 45 |
+
|
| 46 |
+
if text.lower().strip() != unvalid_image_text:
|
| 47 |
+
doc = Create_Doc()
|
| 48 |
+
doc_buffer = doc.markdown_to_word(text)
|
| 49 |
+
st.download_button(
|
| 50 |
+
label="Download",
|
| 51 |
+
data=doc_buffer,
|
| 52 |
+
file_name="output.docx",
|
| 53 |
+
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
| 54 |
+
)
|
| 55 |
|