Spaces:
Sleeping
Sleeping
removed the video generation tab only (not functionality)
Browse files- src/streamlit_app.py +3 -38
src/streamlit_app.py
CHANGED
|
@@ -28,7 +28,6 @@ def main_app():
|
|
| 28 |
|
| 29 |
tabs = st.tabs([
|
| 30 |
"JSON Prompt Generator",
|
| 31 |
-
"Video Generation",
|
| 32 |
"Audio Generator",
|
| 33 |
"Image Generation",
|
| 34 |
"Generate Caption",
|
|
@@ -81,42 +80,8 @@ def main_app():
|
|
| 81 |
logger.exception("JSON Prompt Generator failed")
|
| 82 |
st.error(f"Error: {e}")
|
| 83 |
|
| 84 |
-
# Video Generation
|
| 85 |
-
with tabs[1]:
|
| 86 |
-
st.subheader("Video Generation")
|
| 87 |
-
with st.form("video_generation_form", clear_on_submit=False):
|
| 88 |
-
ref_image = st.file_uploader("Upload an image (used as initial frame)", type=["png", "jpg", "jpeg", "webp"])
|
| 89 |
-
prompt = st.text_area("Prompt", height=140, placeholder="Describe the scene, motion, camera, mood…")
|
| 90 |
-
aspect = st.selectbox("Aspect ratio", ["9:16", "16:9"], index=0)
|
| 91 |
-
resolution = st.selectbox("Resolution", ["720p", "1080p"], index=0)
|
| 92 |
-
gen = st.form_submit_button("Generate Video")
|
| 93 |
-
|
| 94 |
-
if gen:
|
| 95 |
-
if not ref_image:
|
| 96 |
-
st.error("Please upload an image.")
|
| 97 |
-
else:
|
| 98 |
-
try:
|
| 99 |
-
image_bytes = ref_image.read()
|
| 100 |
-
logger.info("Video Gen: img_bytes=%d aspect=%s res=%s prompt_len=%d",
|
| 101 |
-
len(image_bytes or b""), aspect, resolution, len(prompt or ""))
|
| 102 |
-
|
| 103 |
-
with st.spinner("Generating video..."):
|
| 104 |
-
url = video_generation(image_bytes, prompt, aspect, resolution)
|
| 105 |
-
|
| 106 |
-
if url:
|
| 107 |
-
st.success("Video generation request created")
|
| 108 |
-
st.video(url)
|
| 109 |
-
st.write(url)
|
| 110 |
-
st.toast("Video ready", icon="🎬")
|
| 111 |
-
else:
|
| 112 |
-
st.error("No video URL returned.")
|
| 113 |
-
logger.warning("Video Gen: empty URL")
|
| 114 |
-
except Exception as e:
|
| 115 |
-
logger.exception("Video Generation failed")
|
| 116 |
-
st.error(f"Error: {e}")
|
| 117 |
-
|
| 118 |
# Audio Generator
|
| 119 |
-
with tabs[
|
| 120 |
st.subheader("Audio Generator")
|
| 121 |
with st.form("audio_generation_form", clear_on_submit=False):
|
| 122 |
scripts = st.text_area("Scripts", height=180, placeholder="Enter narration text…")
|
|
@@ -151,7 +116,7 @@ def main_app():
|
|
| 151 |
st.error(f"Error: {e}")
|
| 152 |
|
| 153 |
# Image Generation (BG Change)
|
| 154 |
-
with tabs[
|
| 155 |
st.subheader("Image Generation (for changing character's background)")
|
| 156 |
with st.form("image_generation_form", clear_on_submit=False):
|
| 157 |
img = st.file_uploader("Input image", type=["png", "jpg", "jpeg", "webp"])
|
|
@@ -189,7 +154,7 @@ def main_app():
|
|
| 189 |
st.error(f"Error: {e}")
|
| 190 |
|
| 191 |
# Generate Caption
|
| 192 |
-
with tabs[
|
| 193 |
st.subheader("Generate Caption")
|
| 194 |
with st.form("caption_form", clear_on_submit=False):
|
| 195 |
cap_video = st.file_uploader("Input video", type=["mp4", "mov", "mkv"])
|
|
|
|
| 28 |
|
| 29 |
tabs = st.tabs([
|
| 30 |
"JSON Prompt Generator",
|
|
|
|
| 31 |
"Audio Generator",
|
| 32 |
"Image Generation",
|
| 33 |
"Generate Caption",
|
|
|
|
| 80 |
logger.exception("JSON Prompt Generator failed")
|
| 81 |
st.error(f"Error: {e}")
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
# Audio Generator
|
| 84 |
+
with tabs[1]:
|
| 85 |
st.subheader("Audio Generator")
|
| 86 |
with st.form("audio_generation_form", clear_on_submit=False):
|
| 87 |
scripts = st.text_area("Scripts", height=180, placeholder="Enter narration text…")
|
|
|
|
| 116 |
st.error(f"Error: {e}")
|
| 117 |
|
| 118 |
# Image Generation (BG Change)
|
| 119 |
+
with tabs[2]:
|
| 120 |
st.subheader("Image Generation (for changing character's background)")
|
| 121 |
with st.form("image_generation_form", clear_on_submit=False):
|
| 122 |
img = st.file_uploader("Input image", type=["png", "jpg", "jpeg", "webp"])
|
|
|
|
| 154 |
st.error(f"Error: {e}")
|
| 155 |
|
| 156 |
# Generate Caption
|
| 157 |
+
with tabs[3]:
|
| 158 |
st.subheader("Generate Caption")
|
| 159 |
with st.form("caption_form", clear_on_submit=False):
|
| 160 |
cap_video = st.file_uploader("Input video", type=["mp4", "mov", "mkv"])
|