Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +32 -4
src/streamlit_app.py
CHANGED
|
@@ -26,13 +26,25 @@ if uploaded_file:
|
|
| 26 |
image.save(image_path)
|
| 27 |
|
| 28 |
# st.image(image, caption="uploaded image" , use_container_width=True)
|
| 29 |
-
story_style = st.sidebar.selectbox("Choose Story Style" , ["William Shakespeare" , "Leo Tolstoy", "Charles Dickens" , "Haruki Murakami" , "J.K. Rowling" , "Stephen King"])
|
| 30 |
|
| 31 |
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
with st.spinner("Generating Captions..."):
|
| 34 |
captions = generateCaption(image_path)
|
| 35 |
-
st.success(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
story_style = st.sidebar.selectbox("Choose Story Style" , ["William Shakespeare" , "Leo Tolstoy", "Charles Dickens" , "Haruki Murakami" , "J.K. Rowling" , "Stephen King"])
|
|
@@ -48,7 +60,23 @@ if uploaded_file:
|
|
| 48 |
"""
|
| 49 |
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
with st.spinner("Generating Story..."):
|
| 52 |
story = generateStory(captions)
|
| 53 |
-
|
| 54 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
image.save(image_path)
|
| 27 |
|
| 28 |
# st.image(image, caption="uploaded image" , use_container_width=True)
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
+
# with st.spinner("Generating Captions..."):
|
| 33 |
+
# captions = generateCaption(image_path)
|
| 34 |
+
# st.success(f"The image is of : {captions}")
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
with st.spinner("Generating Captions..."):
|
| 39 |
captions = generateCaption(image_path)
|
| 40 |
+
st.success("Caption generated successfully!")
|
| 41 |
+
|
| 42 |
+
st.markdown(f"""
|
| 43 |
+
<div style="background-color:#f0f2f6;padding:15px 20px;border-radius:10px;margin-top:20px;border-left:5px solid #4CAF50;">
|
| 44 |
+
<h4 style="margin-bottom:10px;">🖼️ <strong>Scenario is :</strong></h4>
|
| 45 |
+
<p style="font-size:16px;color:#333;">{captions}</p>
|
| 46 |
+
</div>
|
| 47 |
+
""", unsafe_allow_html=True)
|
| 48 |
|
| 49 |
|
| 50 |
story_style = st.sidebar.selectbox("Choose Story Style" , ["William Shakespeare" , "Leo Tolstoy", "Charles Dickens" , "Haruki Murakami" , "J.K. Rowling" , "Stephen King"])
|
|
|
|
| 60 |
"""
|
| 61 |
|
| 62 |
|
| 63 |
+
# with st.spinner("Generating Story..."):
|
| 64 |
+
# story = generateStory(captions)
|
| 65 |
+
# st.markdown("Generated Story")
|
| 66 |
+
# st.write(story)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
with st.spinner("Generating Story..."):
|
| 70 |
story = generateStory(captions)
|
| 71 |
+
|
| 72 |
+
st.markdown("""
|
| 73 |
+
<div style="background-color:#f9f9f9;padding:15px 20px;border-radius:10px;margin-top:20px;border-left:5px solid #2196F3;">
|
| 74 |
+
<h4 style="margin-bottom:10px;">📖 <strong>Generated Story</strong></h4>
|
| 75 |
+
""", unsafe_allow_html=True)
|
| 76 |
+
|
| 77 |
+
st.markdown(f"""
|
| 78 |
+
<div style="font-size:16px;line-height:1.6;color:#444;">
|
| 79 |
+
{story.replace('\n', '<br>')}
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
""", unsafe_allow_html=True)
|