import React, { useState } from "react";
import { motion } from "framer-motion";
import { Camera, UploadCloud, Search } from "lucide-react";
import Tesseract from "tesseract.js";
export default function PhotoSearchSimple() {
const [image, setImage] = useState(null);
const [loading, setLoading] = useState(false);
const [text, setText] = useState("");
const handleImage = (file) => {
if (!file) return;
setImage(URL.createObjectURL(file));
setLoading(true);
setText("");
// SIMPLE VERSION → OCR + normal search
Tesseract.recognize(file, "eng+ori").then(({ data: { text } }) => {
setText(text);
setLoading(false);
});
};
const searchAnswer = () => {
if (!text) return;
const url =
"https://odishaboardsolutions.com/?s=" + encodeURIComponent(text);
window.location.href = url;
};
return (
{/* Camera (future upgrade) */}
{/* Preview */}
{image && (
)}
{/* Loading */}
{loading && (
)}
{/* Result */}
{text && (
)}
);
}
📷 Scan Question & Find Answer
Upload or click photo to instantly search your solution.
{/* Upload */}Upload question image
handleImage(e.target.files[0])} />Scanning image...
Extracted Question
{text}