Spaces:
Sleeping
Sleeping
Create ui_components.py
Browse files- ui_components.py +28 -0
ui_components.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
def create_sidebar():
|
| 4 |
+
with st.sidebar:
|
| 5 |
+
st.header("About")
|
| 6 |
+
st.write("This AI Marketing Caption Generator helps create engaging captions for your product images.")
|
| 7 |
+
st.write("Upload an image, and our AI will generate a caption tailored for marketing purposes.")
|
| 8 |
+
|
| 9 |
+
st.header("Tips")
|
| 10 |
+
st.write("- Use high-quality images for better results")
|
| 11 |
+
st.write("- Try different images to see how the AI adapts")
|
| 12 |
+
st.write("- Edit and refine the generated captions for your specific needs")
|
| 13 |
+
|
| 14 |
+
def create_main_content(caption):
|
| 15 |
+
st.header("Generated Caption")
|
| 16 |
+
st.write(caption)
|
| 17 |
+
|
| 18 |
+
st.header("Customization Options")
|
| 19 |
+
tone = st.selectbox("Tone", ["Professional", "Casual", "Humorous", "Formal"])
|
| 20 |
+
length = st.slider("Caption Length", min_value=50, max_value=200, value=100, step=10)
|
| 21 |
+
|
| 22 |
+
if st.button("Regenerate Caption"):
|
| 23 |
+
with st.spinner("Regenerating caption..."):
|
| 24 |
+
new_caption = f"{caption} (Regenerated with {tone} tone, {length} characters)"
|
| 25 |
+
st.write(new_caption)
|
| 26 |
+
|
| 27 |
+
st.header("Caption Preview")
|
| 28 |
+
st.text_area("Edit Caption", caption, height=150)
|