SHAMIL SHAHBAZ AWAN commited on
Update app.py
Browse files32 unmodified lines3334353637383916 unmodified lines565758596061625 unmodified lines6869707172737432 unmodified linesdef main():with gr.Blocks(css=""".gradio-container {background: url('https://papers.co/wallpaper/papers.co-vx41-digital-wallpaper-grunge-pattern-background-29-wallpaper.jpg') no-repeat center center fixed;background-size: cover;min-height: 100vh;}16 unmodified lines50% { color: #feb47b; }100% { color: #00b4d8; }}""") as demo:gr.Markdown("# Weight Calculator on Different Planets")gr.Markdown("Enter your weight on Earth and choose a planet to find your weight on it.")5 unmodified lines# Submit button and interactionbutton = gr.Button("Calculate Weight")button.click(calculate_weight, inputs=[earth_weight_input, planet_input], outputs=output)demo.launch()32 unmodified lines3334353637383916 unmodified lines5657585960616263646566676869707172737475767778798081828384858687885 unmodified lines94959697989910010110210310410510610710810911011111211311411511611711811912032 unmodified linesdef main():with gr.Blocks(css=""".gradio-container {background: url('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQrpx_alD_MY29yHYIZryYkBbT-LB-Kb1PpdhDmhb4MPfAIX2WCfOIhYW_6WaxAmR6LW5U&usqp=CAU') no-repeat center center fixed;background-size: cover;min-height: 100vh;}16 unmodified lines50% { color: #feb47b; }100% { color: #00b4d8; }}/* Balloon Animation */.balloon {position: absolute;bottom: 0;animation: rise 6s ease-in-out forwards, float 4s ease-in-out infinite;}@keyframes rise {0% { bottom: 0; opacity: 1; }100% { bottom: 90%; opacity: 0; }}@keyframes float {0% { transform: translateX(0); }50% { transform: translateX(30px); }100% { transform: translateX(0); }}.balloon-text {font-size: 1.5rem;color: white;text-align: center;font-weight: bold;}""") as demo:gr.Markdown("# Weight Calculator on Different Planets")gr.Markdown("Enter your weight on Earth and choose a planet to find your weight on it.")5 unmodified lines# Submit button and interactionbutton = gr.Button("Calculate Weight")# Function to trigger balloon effect using JavaScriptdef trigger_balloon_effect():return """const balloonCount = 5; // Number of balloons to showfor (let i = 0; i < balloonCount; i++) {let balloon = document.createElement('div');balloon.classList.add('balloon');balloon.style.left = Math.random() * 100 + 'vw'; // Random horizontal positionlet balloonText = document.createElement('div');balloonText.classList.add('balloon-text');balloonText.textContent = '🎈'; // Emoji or custom text for the balloonballoon.appendChild(balloonText);document.body.appendChild(balloon);setTimeout(() => balloon.remove(), 6000); // Remove balloon after animation}"""# Connect button click to calculate weight and trigger the balloon effectbutton.click(calculate_weight, inputs=[earth_weight_input, planet_input], outputs=output)button.click(trigger_balloon_effect)demo.launch()
app.py+47-1