Spaces:
Running
Running
Update frontend/src/App.jsx
Browse files- frontend/src/App.jsx +1 -16
frontend/src/App.jsx
CHANGED
|
@@ -12,13 +12,11 @@ import { motion, AnimatePresence, useScroll, useTransform, useSpring } from 'fra
|
|
| 12 |
import { clsx } from 'clsx';
|
| 13 |
import { twMerge } from 'tailwind-merge';
|
| 14 |
|
| 15 |
-
// --- CONFIGURATION ---
|
| 16 |
const API_URL = "https://migueldiaz1-mirage-backend.hf.space";
|
| 17 |
const PROJECT_URL = "https://arxiv.org/abs/2400.00000";
|
| 18 |
const KAGGLE_URL = "https://www.kaggle.com/code/migueldazbenito/mirage";
|
| 19 |
const YOUTUBE_VIDEO_ID = "GlPMrBWtZoQ";
|
| 20 |
|
| 21 |
-
// --- DATA (ENGLISH) ---
|
| 22 |
const MEDICAL_PROMPTS = [
|
| 23 |
{ title: "Glioblastoma Multiforme", text: "MRI of the brain showing a large necrotic glioblastoma in the frontal lobe with edema." },
|
| 24 |
{ title: "Liver Metastasis", text: "CT scan of the abdomen showing multiple hypodense metastatic lesions in the liver." },
|
|
@@ -31,7 +29,6 @@ const DUAL_ARITHMETIC_EXAMPLES = [
|
|
| 31 |
{ title: "Cardiac Pacemaker", query: "Chest X-ray", add: "Pacemaker generator and leads", sub: "No foreign bodies", desc: "Add a pacemaker to the chest X-ray." }
|
| 32 |
];
|
| 33 |
|
| 34 |
-
// --- UTILS ---
|
| 35 |
function cn(...inputs) {
|
| 36 |
return twMerge(clsx(inputs));
|
| 37 |
}
|
|
@@ -51,7 +48,6 @@ const RichText = ({ text, className }) => {
|
|
| 51 |
);
|
| 52 |
};
|
| 53 |
|
| 54 |
-
// --- ANIMATION VARIANTS ---
|
| 55 |
const pageTransition = {
|
| 56 |
initial: { opacity: 0, y: 20 },
|
| 57 |
animate: { opacity: 1, y: 0 },
|
|
@@ -69,7 +65,6 @@ const cardVariant = {
|
|
| 69 |
show: { opacity: 1, y: 0, scale: 1, transition: { type: "spring", stiffness: 40, damping: 10 } }
|
| 70 |
};
|
| 71 |
|
| 72 |
-
// --- VISUAL COMPONENTS ---
|
| 73 |
|
| 74 |
const OpticalGradient = () => {
|
| 75 |
return (
|
|
@@ -156,9 +151,6 @@ const KaggleLogo = ({ className }) => (
|
|
| 156 |
</svg>
|
| 157 |
);
|
| 158 |
|
| 159 |
-
// ==========================================
|
| 160 |
-
// [PREMIUM COMPONENT] Paper Explanation Page
|
| 161 |
-
// ==========================================
|
| 162 |
const PaperExplanation = ({ onBack }) => {
|
| 163 |
const containerRef = useRef(null);
|
| 164 |
const { scrollYProgress } = useScroll({ container: containerRef });
|
|
@@ -487,7 +479,6 @@ const PaperExplanation = ({ onBack }) => {
|
|
| 487 |
};
|
| 488 |
|
| 489 |
|
| 490 |
-
// --- WELCOME SCREEN (MODIFIED) ---
|
| 491 |
const WelcomeScreen = ({ onStart, onOpenPaper }) => {
|
| 492 |
return (
|
| 493 |
<motion.div
|
|
@@ -564,7 +555,6 @@ const WelcomeScreen = ({ onStart, onOpenPaper }) => {
|
|
| 564 |
);
|
| 565 |
};
|
| 566 |
|
| 567 |
-
// UI HELPERS (Sliders, Counters, Checkboxes, Inputs)
|
| 568 |
const ParameterSlider = ({ icon: Icon, label, value, onChange, min, max, step, description, formatValue }) => {
|
| 569 |
return (
|
| 570 |
<div className="space-y-2">
|
|
@@ -694,7 +684,6 @@ const InputField = ({ icon: Icon, value, onChange, placeholder, color = "orange"
|
|
| 694 |
}
|
| 695 |
}, [value]);
|
| 696 |
|
| 697 |
-
// Gradient definitions for borders
|
| 698 |
const gradients = {
|
| 699 |
red: "bg-[conic-gradient(transparent,rgba(239,68,68,1),transparent,rgba(239,68,68,1),transparent)]",
|
| 700 |
rose: "bg-[conic-gradient(transparent,rgba(244,63,94,1),transparent,rgba(244,63,94,1),transparent)]",
|
|
@@ -729,8 +718,6 @@ const InputField = ({ icon: Icon, value, onChange, placeholder, color = "orange"
|
|
| 729 |
);
|
| 730 |
};
|
| 731 |
|
| 732 |
-
// --- DEFINICIONES FALTANTES (MOVIDAS ANTES DE MainInterface) ---
|
| 733 |
-
|
| 734 |
const Column = ({ title, query, color, children }) => (
|
| 735 |
<div className="space-y-6">
|
| 736 |
<div className={`pb-4 border-b border-zinc-800 border-l-4 pl-4 border-l-${color}-500`}>
|
|
@@ -811,7 +798,6 @@ const DescriptionBox = ({ text, title }) => {
|
|
| 811 |
);
|
| 812 |
};
|
| 813 |
|
| 814 |
-
// 3. MAIN APP INTERFACE
|
| 815 |
const MainInterface = ({ onBack }) => {
|
| 816 |
const [query, setQuery] = useState('');
|
| 817 |
const [topK, setTopK] = useState(1);
|
|
@@ -1183,9 +1169,8 @@ const MainInterface = ({ onBack }) => {
|
|
| 1183 |
);
|
| 1184 |
};
|
| 1185 |
|
| 1186 |
-
// --- EXPORTACIÓN FINAL DE LA APP ---
|
| 1187 |
export default function App() {
|
| 1188 |
-
const [mode, setMode] = useState('welcome'); //
|
| 1189 |
|
| 1190 |
return (
|
| 1191 |
<AnimatePresence mode="wait">
|
|
|
|
| 12 |
import { clsx } from 'clsx';
|
| 13 |
import { twMerge } from 'tailwind-merge';
|
| 14 |
|
|
|
|
| 15 |
const API_URL = "https://migueldiaz1-mirage-backend.hf.space";
|
| 16 |
const PROJECT_URL = "https://arxiv.org/abs/2400.00000";
|
| 17 |
const KAGGLE_URL = "https://www.kaggle.com/code/migueldazbenito/mirage";
|
| 18 |
const YOUTUBE_VIDEO_ID = "GlPMrBWtZoQ";
|
| 19 |
|
|
|
|
| 20 |
const MEDICAL_PROMPTS = [
|
| 21 |
{ title: "Glioblastoma Multiforme", text: "MRI of the brain showing a large necrotic glioblastoma in the frontal lobe with edema." },
|
| 22 |
{ title: "Liver Metastasis", text: "CT scan of the abdomen showing multiple hypodense metastatic lesions in the liver." },
|
|
|
|
| 29 |
{ title: "Cardiac Pacemaker", query: "Chest X-ray", add: "Pacemaker generator and leads", sub: "No foreign bodies", desc: "Add a pacemaker to the chest X-ray." }
|
| 30 |
];
|
| 31 |
|
|
|
|
| 32 |
function cn(...inputs) {
|
| 33 |
return twMerge(clsx(inputs));
|
| 34 |
}
|
|
|
|
| 48 |
);
|
| 49 |
};
|
| 50 |
|
|
|
|
| 51 |
const pageTransition = {
|
| 52 |
initial: { opacity: 0, y: 20 },
|
| 53 |
animate: { opacity: 1, y: 0 },
|
|
|
|
| 65 |
show: { opacity: 1, y: 0, scale: 1, transition: { type: "spring", stiffness: 40, damping: 10 } }
|
| 66 |
};
|
| 67 |
|
|
|
|
| 68 |
|
| 69 |
const OpticalGradient = () => {
|
| 70 |
return (
|
|
|
|
| 151 |
</svg>
|
| 152 |
);
|
| 153 |
|
|
|
|
|
|
|
|
|
|
| 154 |
const PaperExplanation = ({ onBack }) => {
|
| 155 |
const containerRef = useRef(null);
|
| 156 |
const { scrollYProgress } = useScroll({ container: containerRef });
|
|
|
|
| 479 |
};
|
| 480 |
|
| 481 |
|
|
|
|
| 482 |
const WelcomeScreen = ({ onStart, onOpenPaper }) => {
|
| 483 |
return (
|
| 484 |
<motion.div
|
|
|
|
| 555 |
);
|
| 556 |
};
|
| 557 |
|
|
|
|
| 558 |
const ParameterSlider = ({ icon: Icon, label, value, onChange, min, max, step, description, formatValue }) => {
|
| 559 |
return (
|
| 560 |
<div className="space-y-2">
|
|
|
|
| 684 |
}
|
| 685 |
}, [value]);
|
| 686 |
|
|
|
|
| 687 |
const gradients = {
|
| 688 |
red: "bg-[conic-gradient(transparent,rgba(239,68,68,1),transparent,rgba(239,68,68,1),transparent)]",
|
| 689 |
rose: "bg-[conic-gradient(transparent,rgba(244,63,94,1),transparent,rgba(244,63,94,1),transparent)]",
|
|
|
|
| 718 |
);
|
| 719 |
};
|
| 720 |
|
|
|
|
|
|
|
| 721 |
const Column = ({ title, query, color, children }) => (
|
| 722 |
<div className="space-y-6">
|
| 723 |
<div className={`pb-4 border-b border-zinc-800 border-l-4 pl-4 border-l-${color}-500`}>
|
|
|
|
| 798 |
);
|
| 799 |
};
|
| 800 |
|
|
|
|
| 801 |
const MainInterface = ({ onBack }) => {
|
| 802 |
const [query, setQuery] = useState('');
|
| 803 |
const [topK, setTopK] = useState(1);
|
|
|
|
| 1169 |
);
|
| 1170 |
};
|
| 1171 |
|
|
|
|
| 1172 |
export default function App() {
|
| 1173 |
+
const [mode, setMode] = useState('welcome'); // States available: 'welcome', 'app', 'paper'
|
| 1174 |
|
| 1175 |
return (
|
| 1176 |
<AnimatePresence mode="wait">
|