Update app.py
Browse files59 unmodified lines60616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115150 unmodified lines2662672682692702712722732742752761 unmodified line27827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231359 unmodified linestranslator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en", device="cpu")PIXABAY_API_KEY = "33492762-a28a596ec4f286f84cd328b17"# CSS ์คํ์ผ ์ ์custom_css = """.gradio-container {background: linear-gradient(45deg, #1a1a1a, #2a2a2a);border-radius: 15px;box-shadow: 0 8px 32px rgba(0,0,0,0.3);}.input-container, .output-container {background: rgba(255,255,255,0.1);backdrop-filter: blur(10px);border-radius: 10px;padding: 20px;transform-style: preserve-3d;transition: transform 0.3s ease;}.input-container:hover {transform: translateZ(20px);}.gallery-item {transition: transform 0.3s ease;border-radius: 8px;overflow: hidden;}.gallery-item:hover {transform: scale(1.05);box-shadow: 0 4px 15px rgba(0,0,0,0.2);}.tabs {background: rgba(255,255,255,0.05);border-radius: 10px;padding: 10px;}button {background: linear-gradient(45deg, #4a90e2, #357abd);border: none;border-radius: 5px;transition: all 0.3s ease;}button:hover {transform: translateY(-2px);box-shadow: 0 4px 15px rgba(74,144,226,0.3);}"""def cleanup_temp_files():temp_dir = tempfile.gettempdir()150 unmodified linestorchaudio.save(audio_save_path, audio, seq_cfg.sampling_rate)return audio_save_path# ์ธํฐํ์ด์ค ์ ์video_search_tab = gr.Interface(fn=search_videos,inputs=gr.Textbox(label="๊ฒ์์ด ์ ๋ ฅ"),outputs=gr.Gallery(label="๊ฒ์ ๊ฒฐ๊ณผ", columns=4, rows=20),css=custom_css,api_name=False)1 unmodified linevideo_to_audio_tab = gr.Interface(fn=video_to_audio,inputs=[gr.Video(label="๋น๋์ค"),gr.Textbox(label="ํ๋กฌํํธ"),gr.Textbox(label="๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ", value="music"),gr.Number(label="์๋", value=0),gr.Number(label="์คํ ์", value=25),gr.Number(label="๊ฐ์ด๋ ๊ฐ๋", value=4.5),gr.Number(label="๊ธธ์ด(์ด)", value=8),],outputs="playable_video",css=custom_css)text_to_audio_tab = gr.Interface(fn=text_to_audio,inputs=[gr.Textbox(label="ํ๋กฌํํธ"),gr.Textbox(label="๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ"),gr.Number(label="์๋", value=0),gr.Number(label="์คํ ์", value=25),gr.Number(label="๊ฐ์ด๋ ๊ฐ๋", value=4.5),gr.Number(label="๊ธธ์ด(์ด)", value=8),],outputs="audio",css=custom_css)# ๋ฉ์ธ ์คํif __name__ == "__main__":gr.TabbedInterface([video_search_tab, video_to_audio_tab, text_to_audio_tab],["๋น๋์ค ๊ฒ์", "๋น๋์ค-์ค๋์ค ๋ณํ", "ํ ์คํธ-์ค๋์ค ๋ณํ"],css=custom_css).launch(allowed_paths=[output_dir])59 unmodified lines60616263646566150 unmodified lines2172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063071 unmodified line30931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434559 unmodified linestranslator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en", device="cpu")PIXABAY_API_KEY = "33492762-a28a596ec4f286f84cd328b17"def cleanup_temp_files():temp_dir = tempfile.gettempdir()150 unmodified linestorchaudio.save(audio_save_path, audio, seq_cfg.sampling_rate)return audio_save_path# CSS ์คํ์ผ ์์ custom_css = """.gradio-container {background: linear-gradient(45deg, #1a1a1a, #2a2a2a);border-radius: 15px;box-shadow: 0 8px 32px rgba(0,0,0,0.3);color: #e0e0e0;}.input-container, .output-container {background: rgba(40, 40, 40, 0.95);backdrop-filter: blur(10px);border-radius: 10px;padding: 20px;transform-style: preserve-3d;transition: transform 0.3s ease;border: 1px solid rgba(255, 255, 255, 0.1);}.input-container:hover {transform: translateZ(20px);box-shadow: 0 8px 32px rgba(0,0,0,0.5);}.gallery-item {transition: transform 0.3s ease;border-radius: 8px;overflow: hidden;background: #2a2a2a;}.gallery-item:hover {transform: scale(1.05);box-shadow: 0 4px 15px rgba(0,0,0,0.4);}.tabs {background: rgba(30, 30, 30, 0.95);border-radius: 10px;padding: 10px;border: 1px solid rgba(255, 255, 255, 0.05);}button {background: linear-gradient(45deg, #2196F3, #1976D2);border: none;border-radius: 5px;transition: all 0.3s ease;color: white;}button:hover {transform: translateY(-2px);box-shadow: 0 4px 15px rgba(33,150,243,0.3);}/* ํ ์คํธ ์ ๋ ฅ ํ๋ ์คํ์ผ */textarea, input[type="text"], input[type="number"] {background: rgba(30, 30, 30, 0.95) !important;border: 1px solid rgba(255, 255, 255, 0.1) !important;color: #e0e0e0 !important;border-radius: 5px !important;}/* ๋ ์ด๋ธ ์คํ์ผ */label {color: #e0e0e0 !important;}/* ๊ฐค๋ฌ๋ฆฌ ๊ทธ๋ฆฌ๋ ์คํ์ผ */.gallery {background: rgba(30, 30, 30, 0.95);padding: 15px;border-radius: 10px;border: 1px solid rgba(255, 255, 255, 0.05);}"""# ์ธํฐํ์ด์ค ์ ์ ์์ (์๋ฌธ์ผ๋ก ๋ณ๊ฒฝ)video_search_tab = gr.Interface(fn=search_videos,inputs=gr.Textbox(label="Search Query(ํ๊ธ์ง์)"),outputs=gr.Gallery(label="Search Results", columns=4, rows=20),css=custom_css,api_name=False)1 unmodified linevideo_to_audio_tab = gr.Interface(fn=video_to_audio,inputs=[gr.Video(label="Input Video"),gr.Textbox(label="Prompt(ํ๊ธ์ง์)"),gr.Textbox(label="Negative Prompt", value="music"),gr.Number(label="Seed", value=0),gr.Number(label="Steps", value=25),gr.Number(label="Guidance Scale", value=4.5),gr.Number(label="Duration (sec)", value=8),],outputs=gr.Video(label="Generated Result"),css=custom_css)text_to_audio_tab = gr.Interface(fn=text_to_audio,inputs=[gr.Textbox(label="Prompt(ํ๊ธ์ง์)"),gr.Textbox(label="Negative Prompt"),gr.Number(label="Seed", value=0),gr.Number(label="Steps", value=25),gr.Number(label="Guidance Scale", value=4.5),gr.Number(label="Duration (sec)", value=8),],outputs=gr.Audio(label="Generated Audio"),css=custom_css)# ๋ฉ์ธ ์คํ ๋ถ๋ถ ์์ if __name__ == "__main__":gr.TabbedInterface([video_search_tab, video_to_audio_tab, text_to_audio_tab],["Video Search", "Video-to-Audio", "Text-to-Audio"],css=custom_css).launch(allowed_paths=[output_dir])
app.py+102-70