import gradio as gr import cv2 import numpy as np # ---------------- FUNCTIONS ---------------- # def diamond_price(carat): price = int(carat * 85000) return f"Estimated Diamond Price: ₹{price:,}" def face_detect(image): if image is None: return None gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) face_cascade = cv2.CascadeClassifier( cv2.data.haarcascades + "haarcascade_frontalface_default.xml" ) faces = face_cascade.detectMultiScale(gray, 1.3, 5) for (x, y, w, h) in faces: cv2.rectangle(image, (x, y), (x + w, y + h), (0, 180, 255), 2) return image # ---------------- CREATIVE SAFE CSS ---------------- # css = """ body { background: linear-gradient(120deg, #fdf2f8, #eef2ff, #ecfeff); font-family: 'Segoe UI', sans-serif; color: #1e293b; } h1 { color: #4338ca; } h2 { color: #0f172a; } .card { background: white; border-radius: 16px; padding: 20px; box-shadow: 0 12px 30px rgba(0,0,0,0.08); margin-bottom: 20px; } .gr-button { background: linear-gradient(135deg, #6366f1, #ec4899); color: white; border-radius: 14px; font-weight: 600; } .gr-button:hover { box-shadow: 0 8px 20px rgba(236,72,153,0.35); } """ # ---------------- UI ---------------- # with gr.Blocks(css=css, title="Simranpreet Kaur | AI Portfolio") as demo: gr.Markdown("""

Simranpreet Kaur

AI • Machine Learning • Computer Vision

📍 Fatehgarh Sahib, Punjab

📧 spreetkaur937@gmail.com

""") gr.Markdown("""

About Me

B.Tech Computer Science (2022–2026) student passionate about building intelligent and practical AI systems including prediction models and real-time computer vision applications.

""") with gr.Tabs(): with gr.Tab("💎 Diamond Price Prediction"): gr.Markdown("

Diamond Price Prediction

") carat = gr.Slider(0.1, 5.0, step=0.1, label="Carat") output = gr.Textbox(label="Predicted Price") carat.change(diamond_price, carat, output) with gr.Tab("🧑 Face Detection"): gr.Markdown("

Face Detection

") img = gr.Image(type="numpy", label="Upload Image") out = gr.Image(label="Detected Faces") img.change(face_detect, img, out) with gr.Tab("🔊 Text to Speech"): gr.Markdown("

Text to Speech

") gr.Textbox(label="Enter text (demo description only)") with gr.Tab("📊 Stock Market Analysis"): gr.Markdown("""

Stock Market Analysis

""") gr.Markdown("""

Contact

Email: spreetkaur937@gmail.com

Hosted on Hugging Face Spaces

""") demo.launch()