Spaces:
Running
Running
File size: 17,447 Bytes
cead143 1a8a86c 4862dc2 60d5502 4862dc2 671d7a3 28cb32b 853931d 2f686d1 fe200d2 054f31c b19dce0 28cb32b 5888805 4862dc2 28cb32b 4862dc2 28cb32b 60d5502 f562484 bb92fc2 f562484 bb92fc2 c4ad0e3 1a8a86c d89edc0 1a8a86c d89edc0 1a8a86c d89edc0 1a8a86c d89edc0 1a8a86c d89edc0 1a8a86c d89edc0 1a8a86c 2f81155 1a8a86c d89edc0 2f81155 1a8a86c d89edc0 1a8a86c d89edc0 2f81155 1a8a86c 8eb8148 4862dc2 e8f12b0 4862dc2 b758ac3 8eb8148 b758ac3 8eb8148 3b980bb dd4114b 2d944d1 5dc634f 2d944d1 3b980bb d299663 15f8474 d299663 3b980bb 15f8474 d299663 e88984b d299663 fe200d2 dd4114b fe200d2 24a0c28 180340b fe200d2 f9a4649 fe200d2 f9a4649 180340b 054f31c b19dce0 054f31c edfc9c4 c187d44 cb97e6c c1f64d0 e07786f 573089b d444a94 7f3d584 9696e9c 180340b 5d77b58 7f3d584 d444a94 e26b941 180340b e07786f 88421c4 2e4ab2e 88421c4 e07786f ccb75f9 3cb39d5 cba66c6 e9db840 95fb8ad e07786f ccb75f9 3cb39d5 cba66c6 e9db840 95fb8ad e07786f 3a21b5c 88421c4 e07786f 87ae6cb edfc9c4 d80d56f edfc9c4 0cc46fe edfc9c4 3b980bb d80d56f edfc9c4 150cfea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
import streamlit as st
import requests
import streamlit.components.v1 as components
from gtts import gTTS
from gtts.lang import tts_langs
from io import BytesIO
import os
# νμ΄μ§ μ€μ
st.set_page_config(page_title="ViDraft", layout="wide")
# μ¬μ΄λλ° νμ΄ν μ€μ
st.sidebar.title("ViDraft")
# λ©λ΄ λ° νμ λ©λ΄ μ μ
menus = {
"Home": [],
"BEST": ["Face Swap", "Image Matching", "Face Avatar", "Zeroshot Voice", "HOT"],
"Free Stock": ["Template Video", "Search Video", "Search Image"],
"Image": ["Face Swap", "Remove Background", "Compositing", "Image Matching", "URL Screenshot"],
"Video": ["Face Avatar", "Remove Background", "Compositing"],
"Sound": ["TTS(Voice)" ,"Zeroshot Voice","Image SFX", "Video SFX","Image Music", "Video Music"]
}
# μΈμ
μν μ΄κΈ°ν
if 'current_menu' not in st.session_state:
st.session_state['current_menu'] = 'Home'
if 'current_sub_menu' not in st.session_state:
st.session_state['current_sub_menu'] = ''
# λ©μΈ λ©λ΄ μ ν
selected_menu = st.sidebar.selectbox("Menu", list(menus.keys()), key='main_menu')
st.session_state['current_menu'] = selected_menu
# νμ λ©λ΄ μ ν (ν΄λΉλλ κ²½μ°)
if selected_menu in menus:
selected_sub_menu = st.sidebar.selectbox("Sub Menu", [""] + menus[selected_menu], key=f'sub_menu_{selected_menu}')
st.session_state['current_sub_menu'] = selected_sub_menu
else:
st.session_state['current_sub_menu'] = ''
# 'Sound' λ©λ΄μ 'TTS(Voice)' μ ν μ
if selected_menu == "Sound" and selected_sub_menu == "TTS(Voice)":
st.header("Text-to-Speech")
# ν
μ€νΈ μ
λ ₯
text = st.text_area("Enter text to synthesize", "Hello, welcome to ViDraft TTS service.")
# μ§μλλ μΈμ΄ λͺ©λ‘μ λΆλ¬μ΅λλ€.
languages_dict = tts_langs()
# ISO 639-1 νμ€μ λ°λΌ λ κΈμ μ½λλ₯Ό κ°μ§ μΈμ΄λ§ νν°λ§
two_letter_languages = {code: lang for code, lang in languages_dict.items() if len(code) == 2}
# μΈμ΄ μ νμ μν selectboxλ₯Ό μμ±ν©λλ€.
selected_language_code = st.selectbox(
"Choose Language",
options=list(two_letter_languages.keys()),
format_func=lambda x: f"{two_letter_languages[x]} ({x})",
index=list(two_letter_languages.keys()).index('en') # 'en'μ κΈ°λ³Έ μΈμ΄λ‘ μ€μ
)
# 'Synthesize' λ²νΌ
if st.button("Synthesize"):
if text:
try:
# μ νλ μΈμ΄λ‘ gTTS κ°μ²΄ μμ±
tts = gTTS(text=text, lang=selected_language_code, slow=False)
audio_file = BytesIO()
tts.write_to_fp(audio_file)
audio_file.seek(0)
# μμ±λ μ€λμ€ νμΌμ μ¬μ
st.audio(audio_file, format="audio/mp3")
except Exception as e:
st.error(f"Error: {e}")
else:
st.warning("Please enter some text to synthesize.")
# Pexels API ν€ μ€μ
PEXELS_API_KEY = "5woz23MGx1QrSY0WHFb0BRi29JvbXPu97Hg0xnklYgHUI8G0w23FKH62"
def search_images(keyword, per_page=80):
"""μ΄λ―Έμ§ κ²μ ν¨μ"""
url = f"https://api.pexels.com/v1/search?query={keyword}&per_page={per_page}"
headers = {"Authorization": PEXELS_API_KEY}
response = requests.get(url, headers=headers).json()
images = []
if 'photos' in response:
for photo in response['photos']:
images.append(photo['src']['original'])
return images
def search_videos(keyword, per_page=80):
"""λΉλμ€ κ²μ ν¨μ"""
url = f"https://api.pexels.com/videos/search?query={keyword}&per_page={per_page}"
headers = {"Authorization": PEXELS_API_KEY}
response = requests.get(url, headers=headers).json()
videos = []
if 'videos' in response:
for video in response['videos']:
videos.append(video['video_files'][0]['link'])
return videos
# 'Search Image' μ ν μ
if selected_menu == "Free Stock" and st.session_state['current_sub_menu'] == "Search Image":
keyword = st.text_input("Enter a keyword to search for images")
if keyword:
images = search_images(keyword)
cols = st.columns(3) # 3μ΄λ‘ μ΄λ―Έμ§ νμ
for idx, img in enumerate(images):
with cols[idx % 3]:
st.image(img)
# 'Search Video' μ ν μ
if selected_menu == "Free Stock" and st.session_state['current_sub_menu'] == "Search Video":
keyword = st.text_input("Enter a keyword to search for videos")
if keyword:
videos = search_videos(keyword)
cols = st.columns(3) # 3μ΄λ‘ λΉλμ€ νμ
for idx, video in enumerate(videos):
with cols[idx % 3]:
st.video(video)
# 'Image' λ©λ΄μμ 'Remove Background' μ ν μ
if selected_menu == "Image" and st.session_state['current_sub_menu'] == "Remove Background":
st.header("Remove Background")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-vidnuki.hf.space", width=None, height=768, scrolling=True)
# 'Image' λ©λ΄μμ 'Compositing' μ ν μ
if selected_menu == "Image" and st.session_state['current_sub_menu'] == "Compositing":
st.header("Compositing")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-vidistudio.hf.space", width=None, height=1800, scrolling=True)
# 'Image' λ©λ΄μμ 'Face Swap' μ ν μ
if selected_menu == "Image" and st.session_state['current_sub_menu'] == "Face Swap":
st.header("Face Swap")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://seawolf2357-vidifs.hf.space", width=None, height=1800, scrolling=True)
# 'video' λ©λ΄μμ 'Compositing' μ ν μ
if selected_menu == "Video" and st.session_state['current_sub_menu'] == "Compositing":
st.header("Compositing")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-vidvstudio.hf.space", width=None, height=1800, scrolling=True)
# 'video' λ©λ΄μμ 'Compositing' μ ν μ
if selected_menu == "Video" and st.session_state['current_sub_menu'] == "Remove Background":
st.header("Remove Background")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-vidvback.hf.space", width=None, height=1800, scrolling=True)
# 'sound' λ©λ΄μμ 'SFX' μ ν μ
if selected_menu == "Sound" and st.session_state['current_sub_menu'] == "Image SFX":
st.header("Image SFX")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-vidisfx.hf.space", width=None, height=1800, scrolling=True)
# 'sound' λ©λ΄μμ 'SFX' μ ν μ
if selected_menu == "Sound" and st.session_state['current_sub_menu'] == "Video SFX":
st.header("Video SFX")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://fffiloni-Video-to-SoundFX.hf.space", width=None, height=1800, scrolling=True)
# 'Image' λ©λ΄μμ 'Image Matching' μ ν μ
if selected_menu == "Image" and st.session_state['current_sub_menu'] == "Image Matching":
st.header("Image Matching")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://seawolf2357-vidimatch.hf.space", width=None, height=1800, scrolling=True)
# 'Image' λ©λ΄μμ 'URL Screenshot' μ ν μ
if selected_menu == "Image" and st.session_state['current_sub_menu'] == "URL Screenshot":
st.header("URL Screenshot")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-vidiscreen.hf.space", width=None, height=1800, scrolling=True)
# 'sound' λ©λ΄μμ 'Video Music' μ ν μ
if selected_menu == "Sound" and st.session_state['current_sub_menu'] == "Video Music":
st.header("Video Music")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-vidsm.hf.space", width=None, height=1800, scrolling=True)
# 'sound' λ©λ΄μμ 'Image Music' μ ν μ
if selected_menu == "Sound" and st.session_state['current_sub_menu'] == "Image Music":
st.header("Image Music")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-vidim.hf.space", width=None, height=1800, scrolling=True)
# 'BEST' λ©λ΄μμ 'Face Swap' μ ν μ
if selected_menu == "BEST" and st.session_state['current_sub_menu'] == "Face Swap":
st.header("Face Swap")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://seawolf2357-vidifs.hf.space", width=None, height=1800, scrolling=True)
# 'BEST' λ©λ΄μμ 'Image Matching' μ ν μ
if selected_menu == "BEST" and st.session_state['current_sub_menu'] == "Image Matching":
st.header("Image Matching")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://seawolf2357-vidimatch.hf.space", width=None, height=1800, scrolling=True)
# 'BEST' λ©λ΄μμ 'HOT' μ ν μ
if selected_menu == "BEST" and st.session_state['current_sub_menu'] == "HOT":
st.header("Image & Video EDIT")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://seawolf2357-vidraftgpu.hf.space", width=None, height=1800, scrolling=True)
# 'video' λ©λ΄μμ 'Face Avatar' μ ν μ
if selected_menu == "Video" and st.session_state['current_sub_menu'] == "Face Avatar":
st.header("Remove Background")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-face.hf.space", width=None, height=1800, scrolling=True)
# 'BEST' λ©λ΄μμ 'Face Avatar' μ ν μ
if selected_menu == "BEST" and st.session_state['current_sub_menu'] == "Face Avatar":
st.header("Remove Background")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://arxivgpt-face.hf.space", width=None, height=1800, scrolling=True)
# 'sound' λ©λ΄μμ 'Zeroshot Voice' μ ν μ
if selected_menu == "Sound" and st.session_state['current_sub_menu'] == "Zeroshot Voice":
st.header("Zeroshot Voice")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://seawolf2357-vidsvclo.hf.space", width=None, height=1800, scrolling=True)
# 'BEST' λ©λ΄μμ 'Zeroshot Voice' μ ν μ
if selected_menu == "BEST" and st.session_state['current_sub_menu'] == "Zeroshot Voice":
st.header("Zeroshot Voice")
# iframeμ μ¬μ©νμ¬ μΈλΆ URL μλ² λ
components.iframe("https://seawolf2357-vidsvclo.hf.space", width=None, height=1800, scrolling=True)
# 'Home' νμ΄μ§ νμ
if selected_menu == "Home":
st.image("banner2.jpg", use_column_width=True)
st.header("Welcome to ViDraft")
st.header("'Create Contents, ViDraft Value-UP'")
# νμ λ©μμ§ λ° μλΉμ€ μ€λͺ
welcome_text = """
Welcome to our dynamic platform, where creativity meets technology across a vast spectrum of multimedia services. Our service offers an extensive array of options for every multimedia need:
- **Video Template (OpenAI SORA)**: "Discover a world of creativity with OpenAI SORA's Video Templates. From captivating intros to engaging outros, our AI-powered templates transform your visions into cinematic realities."
- **Free Stock: Video Search**: "Dive into an expansive ocean of premium stock videos. Whether it's breathtaking landscapes or dynamic urban life, find the perfect clip to elevate your project, all at your fingertips."
- **Free Stock: Image Search**: "Explore a vast gallery of stunning images, curated to perfection. From the serene to the spectacular, uncover the ideal visual complement for your next creative endeavor."
- **Multilingual Text to Speech(TTS)**: "Bring your content to life in any language with our Multilingual Text to Speech technology. Experience seamless, natural-sounding voices that captivate your audience, no matter where they are."
- **Remove Image Background**: "Eradicate distractions and focus on what matters. Our AI swiftly removes any background, offering you a clean slate to unleash your creativity or perfectly blend your subject into new environments."
- **Remove Video Background**: "Transform your videos with the ability to remove and replace backgrounds effortlessly. Engage your audience with stunning visuals, no green screen required."
- **Video Compositing**: "Merge reality with imagination. Our Video Compositing technology seamlessly integrates various elements into your footage, creating a cohesive and visually stunning masterpiece."
- **Image Compositing**: "Elevate your images to art. Combine multiple elements with unparalleled precision, crafting compositions that tell a story, evoke emotions, or simply astound."
- **Face Swap Image**: "Step into a new identity or bring historical figures to life. Our Face Swap technology allows you to seamlessly transpose faces in images, unlocking endless creative possibilities."
- **Image SFX**: "Enhance your images with special effects that captivate. From subtle enhancements to dramatic transformations, our Image SFX tools let your creativity run wild."
- **Video SFX**: "Elevate your videos with extraordinary special effects. Whether you're creating an action-packed adventure or a serene landscape, our Video SFX library brings your vision to life."
- **Image Matching**: "Unveil the synergy between visuals with our Image Matching technology. Let AI seamlessly analyze and match disparate images, bridging the gap between creativity and coherence."
- **Remote URL Screenshot**: "Capture the essence of any website instantly with Remote URL Screenshot. Simply input a URL and let our system fetch and present a crisp snapshot of the site's main page, effortlessly."
- **Image to Music**: "Elevate your image to a symphonic level with image to Music. Upload any footage and witness as our AI discerns the essence of your visuals, crafting a harmonious soundtrack tailored specifically to enhance your video. Seamlessly integrated, the result is a beautifully augmented video experience, enriched with its own unique, AI-generated music."
- **Video to Music**: "Elevate your videos to a symphonic level with Video to Music. Upload any footage and witness as our AI discerns the essence of your visuals, crafting a harmonious soundtrack tailored specifically to enhance your video. Seamlessly integrated, the result is a beautifully augmented video experience, enriched with its own unique, AI-generated music."
Join us to transform your creative ideas into reality with cutting-edge technology designed for creators, by creators.
- Contact: [email protected] *Powered by ArXivGPT, Huggingface, Gradio, Streamlit
"""
st.write(welcome_text)
# μ΄λ―Έμ§λ€μ ν μ€μ 3μ₯μ© λ°°μΉ
image_files = [
"ViDraft-Video-Templet.png",
"ViDraft-Video-search.png",
"ViDraft-Image-search.png",
"ViDraft-TTS.png",
"ViDraft-image-remove background.png",
"ViDraft-video-remove-back.png",
"ViDraft-video-comp.png",
"ViDraft-image-comp.png",
"ViDraft-image-face swap.png",
"ViDraft-image-sfx.png",
"ViDraft-video-sfx.png",
"ViDraft-image-screen.png",
"ViDraft-image-match.png",
"ViDraft-sound-music.png",
"ViDraft-image-music.png"
]
image_texts = [
"Video Template(OpenAI SORA)",
"Free Stock: Video Search",
"Free Stock: Image Search",
"Multilingual Text to Speech(TTS)",
"Remove image background",
"Remove Video background",
"Video Compositing",
"Image Compositing",
"Face Swap Image",
"Image SFX",
"Video SFX",
"Remote URL Screenshot",
"Image Matching",
"Video to Music",
"Image to Music"
]
for i in range(0, len(image_files), 3):
cols = st.columns(3)
for idx, col in enumerate(cols):
if i + idx < len(image_files):
col.image(image_files[i + idx], use_column_width=True)
col.markdown(f"<div style='text-align: center; font-weight: bold; font-size: 20px;'>{image_texts[i + idx]}</div>", unsafe_allow_html=True)
elif selected_menu == "Free Stock":
# 'Free Stock' λ©λ΄ μ ν μ μ²λ¦¬ λ‘μ§
if st.session_state['current_sub_menu'] == "Template Video":
st.header("Template Videos")
st.write("Explore a variety of video templates crafted with the innovative technology of OpenAI SORA. Dive into an immersive experience with samples generated by the cutting-edge AI, showcasing the potential to transform your creative ideas into captivating visual stories.")
# λΉλμ€ νμΌ κ²½λ‘ μ€μ λ° λΉλμ€ νμ λ‘μ§
video_files = ["ex1.mp4", "ex2.mp4", "ex3.mp4", "ex4.mp4", "ex5.mp4", "ex6.mp4", "ex7.mp4", "ex8.mp4", "ex9.mp4", "ex10.mp4", "ex11.mp4", "ex12.mp4", "ex13.mp4", "ex14.mp4", "ex15.mp4", "ex16.mp4", "ex17.mp4", "ex18.mp4"]
# κ°€λ¬λ¦¬ ννλ‘ λΉλμ€ νμ
cols = st.columns(2) # 2κ°μ μ΄λ‘ λκ² λ°°μΉ
for index, video_file in enumerate(video_files):
with cols[index % 2]:
st.video(video_file)
# 'Scripts' λ©λ΄ μ ν μ μ²λ¦¬ λ‘μ§
elif selected_menu == "Scripts":
st.header("Scripts")
st.write("Script writing tools and resources.") |