import gradio as gr from gtts import gTTS from moviepy.editor import ColorClip, TextClip, CompositeVideoClip, AudioFileClip import os, random, tempfile def pc_yadav_real_agent(hint): if not hint: return None, "Bhai hint to de!", "" # Smart logic - agent khud kaam karta hai hint_lower = hint.lower() if "kid" in hint_lower: title = "Kids Dancing Party 🎈" story = f"Trending Kids Story: {hint}. Chote bachche khush hokar dance kar rahe hain, rang birange balloons ke saath! Like karo, share karo!" color = (255, 153, 204) elif "chai" in hint_lower: title = "Jaipur Chai Special ☕" story = f"Jaipur ki chai pe kahani: {hint}. Garam chai, mitti ki khushbu aur dosti!" color = (204, 153, 102) else: title = "PcYadav Viral Reel 🔥" story = f"{hint} - Ye hai viral hone wali kahani! PcYadav ki taraf se special!" color = (102, 178, 255) # Real voice tmpdir = tempfile.mkdtemp() audio_path = os.path.join(tmpdir, "voice.mp3") try: tts = gTTS(text=story, lang='hi') tts.save(audio_path) audio = AudioFileClip(audio_path) duration = audio.duration + 1 except: audio_path = None duration = 8 # Real video file video_clip = ColorClip(size=(720, 1280), color=color, duration=duration) try: txt = TextClip(title + "\n" + story[:100], fontsize=40, color='white', font='DejaVu-Sans-Bold', method='caption', size=(650, None), stroke_color='black', stroke_width=2) txt = txt.set_position('center').set_duration(duration) final = CompositeVideoClip([video_clip, txt]) except: final = video_clip if audio_path and os.path.exists(audio_path): final = final.set_audio(AudioFileClip(audio_path)) out_path = os.path.join(tmpdir, "PcYadav_Real.mp4") final.write_videofile(out_path, fps=24, verbose=False, logger=None) return out_path, story, f"✅ Agent ne kaam kar diya! Video ready hai. {title}" with gr.Blocks(theme=gr.themes.Soft(primary_hue="orange"), title="PcYadav Pro Real Agent") as demo: gr.Markdown("# 🤖 PcYadav - REAL Agent OS\n### Sirf hint do, pura kaam agent khud karega - No API Key Needed!") with gr.Row(): hint = gr.Textbox(label="Hint do (ex: trending kids dance)", placeholder="Jaise: trending kids animate dance party", lines=2) btn = gr.Button("🚀 Agent Ko Kaam Pe Lagao - REAL VIDEO BANAO", variant="primary", size="lg") with gr.Row(): video = gr.Video(label="Tera Real Video (Asli File)") script_out = gr.Textbox(label="Agent ne jo script banaya") status = gr.Textbox(label="Status") btn.click(pc_yadav_real_agent, inputs=hint, outputs=[video, script_out, status]) gr.Markdown("Made by PcYadav - Ye asli kaam karta hai, sirf design nahi!") demo.launch()