import gradio as gr import requests languages = { "English": "en", "Indonesian": "id", "Spanish": "es", "French": "fr", "German": "de", "Italian": "it", "Portuguese": "pt", "Russian": "ru", "Japanese": "ja", "Korean": "ko", "Chinese (Simplified)": "zh", "Arabic": "ar", "Turkish": "tr", "Hindi": "hi", "Thai": "th" } genres = ["Horror", "Romance", "Fantasy", "Sci-Fi", "Mystery", "Comedy", "Slice of Life"] styles = ["Realistic", "Semi-Realistic", "Cartoon", "Anime", "Noir", "Pixar-like", "Surreal"] moods = ["Funny", "Sad", "Mysterious", "Emotional", "Light-hearted", "Dark", "Fantastical"] rations = ["9:16 (Vertical Smartphone)", "16:9 (Landscape)", "1:1 (Square)"] audio = ["Rain", "Glitch", "Heartbeat", "Wind", "Footsteps", "Music Box", "Silence"] camera = ["Static", "Slow Zoom In", "Dolly In", "Drone Shot", "360° Pan", "Handheld Shake"] lighting = ["Soft Light", "Backlit", "Dark Shadows", "Flickering", "Cinematic Contrast"] ambience = ["Peaceful", "Chaotic", "Eerie", "Melancholic", "Magical", "Claustrophobic"] voice_line = ["", "‘What is this place?’", "‘Don't look behind you…’", "‘We meet again.’"] spoken_language = ["None", "English", "Japanese", "Indonesian", "Arabic", "Korean"] times = ["Morning", "Afternoon", "Sunset", "Night", "Midnight"] def translate_text(text, target_lang): try: response = requests.post( "https://translate.argosopentech.com/translate", data={"q": text, "source": "en", "target": target_lang, "format": "text"}, headers={"Content-Type": "application/x-www-form-urlencoded"} ) if response.status_code == 200: return response.json()["translatedText"] else: return "Translation error: " + response.text except: return "Translation failed." def generate_prompt(lang_key, genre, style, mood, ratio, setting, character, object, audio_fx, camera_move, lighting_fx, ambience_fx, dialogue, spoken_lang, extra_detail, timeslot, translation): language = languages.get(lang_key, "en") prompt = f"A {genre.lower()} scene set in {setting} during {timeslot}, featuring {character} and {object}. Visual style: {style}. Mood: {mood}. Format: {ratio}. Audio: {audio_fx}. Camera: {camera_move}. Lighting: {lighting_fx}. Atmosphere: {ambience_fx}." if dialogue: prompt += f" The character says: {dialogue} (in {spoken_lang})." if extra_detail: prompt += f" Additional details: {extra_detail}." if translation and language != "en": return translate_text(prompt, language) return prompt with gr.Blocks() as app: gr.Markdown("""# 🎬 Gemini Veo 3 Ultimate Prompt Generator Lengkap dengan fitur suara, musik, sinematik, lighting, dialog, waktu, dan efek suasana. """) with gr.Row(): lang = gr.Dropdown(list(languages.keys()), label="Output Language", value="English") genre = gr.Dropdown(genres, label="Genre") style = gr.Dropdown(styles, label="Visual Style") with gr.Row(): mood = gr.Dropdown(moods, label="Mood") ratio = gr.Dropdown(rations, label="Aspect Ratio") timeslot = gr.Dropdown(times, label="Waktu Kejadian") setting = gr.Textbox(label="Lokasi Adegan") character = gr.Textbox(label="Karakter Utama") object = gr.Textbox(label="Objek atau Fokus") with gr.Row(): audio_fx = gr.Dropdown(audio, label="Sound / Music") camera_move = gr.Dropdown(camera, label="Gerakan Kamera") lighting_fx = gr.Dropdown(lighting, label="Pencahayaan") ambience_fx = gr.Dropdown(ambience, label="Suasana Video") dialogue = gr.Dropdown(voice_line, label="Kalimat yang Diucapkan") spoken_lang = gr.Dropdown(spoken_language, label="Bahasa Percakapan") extra_detail = gr.Textbox(label="Tambahan Detail (opsional)") translate = gr.Checkbox(label="Terjemahkan prompt ke bahasa yang dipilih") output = gr.Textbox(label="Final Prompt", lines=6) generate = gr.Button("🔮 Generate Prompt") generate.click(fn=generate_prompt, inputs=[lang, genre, style, mood, ratio, setting, character, object, audio_fx, camera_move, lighting_fx, ambience_fx, dialogue, spoken_lang, extra_detail, timeslot, translate], outputs=output) app.launch()