Spaces:
Running
Running
add options for different model types
Browse files
frontend/src/App.jsx
CHANGED
|
@@ -3,13 +3,11 @@ import ModelInputBar from "./components/ModelInputBar";
|
|
| 3 |
import ModelLayersCard from "./components/ModelLayersCard";
|
| 4 |
|
| 5 |
export default function App() {
|
| 6 |
-
const [modelName, setModelName] = useState("");
|
| 7 |
-
const [selectedOption, setSelectedOption] = useState("none");
|
| 8 |
const [structure, setStructure] = useState(null);
|
| 9 |
const [loading, setLoading] = useState(false);
|
| 10 |
const [error, setError] = useState("");
|
| 11 |
|
| 12 |
-
const fetchModelStructure = async () => {
|
| 13 |
if (!modelName) return;
|
| 14 |
setLoading(true);
|
| 15 |
setError("");
|
|
@@ -51,10 +49,6 @@ export default function App() {
|
|
| 51 |
|
| 52 |
{/* Input Bar */}
|
| 53 |
<ModelInputBar
|
| 54 |
-
modelName={modelName}
|
| 55 |
-
setModelName={setModelName}
|
| 56 |
-
selectedOption={selectedOption}
|
| 57 |
-
setSelectedOption={setSelectedOption}
|
| 58 |
loading={loading}
|
| 59 |
fetchModelStructure={fetchModelStructure}
|
| 60 |
/>
|
|
@@ -79,7 +73,7 @@ export default function App() {
|
|
| 79 |
|
| 80 |
{/* Footer */}
|
| 81 |
<footer className="mt-8 text-slate-500 text-sm text-center">
|
| 82 |
-
|
| 83 |
</footer>
|
| 84 |
</div>
|
| 85 |
);
|
|
|
|
| 3 |
import ModelLayersCard from "./components/ModelLayersCard";
|
| 4 |
|
| 5 |
export default function App() {
|
|
|
|
|
|
|
| 6 |
const [structure, setStructure] = useState(null);
|
| 7 |
const [loading, setLoading] = useState(false);
|
| 8 |
const [error, setError] = useState("");
|
| 9 |
|
| 10 |
+
const fetchModelStructure = async (modelName, selectedOption) => {
|
| 11 |
if (!modelName) return;
|
| 12 |
setLoading(true);
|
| 13 |
setError("");
|
|
|
|
| 49 |
|
| 50 |
{/* Input Bar */}
|
| 51 |
<ModelInputBar
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
loading={loading}
|
| 53 |
fetchModelStructure={fetchModelStructure}
|
| 54 |
/>
|
|
|
|
| 73 |
|
| 74 |
{/* Footer */}
|
| 75 |
<footer className="mt-8 text-slate-500 text-sm text-center">
|
| 76 |
+
Still under development.
|
| 77 |
</footer>
|
| 78 |
</div>
|
| 79 |
);
|
frontend/src/components/ModelInputBar.jsx
CHANGED
|
@@ -1,37 +1,52 @@
|
|
| 1 |
-
import React, { useState } from "react";
|
| 2 |
|
| 3 |
-
export default function ModelInputBar({
|
| 4 |
// Single selection: user can pick one of several fetch options
|
| 5 |
const options = [
|
| 6 |
-
{ label: "Not Sure", value: "none" },
|
| 7 |
-
{ label: "Causal Language Models (e.g. GPT, LLaMA, Phi, Mistral)", value: "causal" },
|
| 8 |
-
{ label: "Masked Language Models (BERT, RoBERTa, DistilBERT)", value: "masked" },
|
| 9 |
-
{ label: "Sequence Classification (text classification, sentiment analysis)", value: "sequence" },
|
| 10 |
-
{ label: "Token Classification (NER, POS tagging)", value: "token" },
|
| 11 |
-
{ label: "Question Answering Models (e.g. BERT QA, RoBERTa QA)", value: "qa" },
|
| 12 |
-
{ label: "
|
| 13 |
-
{ label: "
|
| 14 |
-
{ label: "Vision models (image classification, CLIP vision tower, etc.)", value: "vision" },
|
| 15 |
];
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
const handleFetch = () => {
|
| 20 |
-
|
|
|
|
| 21 |
};
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
<div className="flex flex-col gap-2 mb-4 w-full">
|
| 25 |
<div className="flex gap-2 w-full">
|
| 26 |
<input
|
| 27 |
type="text"
|
| 28 |
value={modelName}
|
| 29 |
onChange={(e) => setModelName(e.target.value)}
|
| 30 |
-
placeholder=
|
| 31 |
className="flex-1 px-4 py-2 rounded-lg border border-slate-200 focus:outline-none focus:ring-2 focus:ring-sky-300"
|
| 32 |
onKeyDown={(e) => {
|
| 33 |
if (e.key === "Enter") handleFetch();
|
| 34 |
}}
|
|
|
|
|
|
|
| 35 |
aria-label="Model name"
|
| 36 |
/>
|
| 37 |
|
|
@@ -54,7 +69,7 @@ return (
|
|
| 54 |
name="fetchOption"
|
| 55 |
value={option.value}
|
| 56 |
checked={selectedOption === option.value}
|
| 57 |
-
onChange={
|
| 58 |
className="w-4 h-4"
|
| 59 |
/>
|
| 60 |
<span>{option.label}</span>
|
|
|
|
| 1 |
+
import React, { useState, useEffect, useRef } from "react";
|
| 2 |
|
| 3 |
+
export default function ModelInputBar({ loading, fetchModelStructure }) {
|
| 4 |
// Single selection: user can pick one of several fetch options
|
| 5 |
const options = [
|
| 6 |
+
{ label: "Not Sure", value: "none", default: "deepseek-ai/deepseek-moe-16b-base" },
|
| 7 |
+
{ label: "Causal Language Models (e.g. GPT, LLaMA, Phi, Mistral)", value: "causal", default: "gpt2"},
|
| 8 |
+
{ label: "Masked Language Models (BERT, RoBERTa, DistilBERT)", value: "masked", default: "bert-base-uncased" },
|
| 9 |
+
{ label: "Sequence Classification (text classification, sentiment analysis)", value: "sequence", default: "distilbert-base-uncased" },
|
| 10 |
+
{ label: "Token Classification (NER, POS tagging)", value: "token", default: "dbmdz/bert-large-cased-finetuned-conll03-english" },
|
| 11 |
+
{ label: "Question Answering Models (e.g. BERT QA, RoBERTa QA)", value: "qa", default: "distilbert-base-uncased-distilled-squad" },
|
| 12 |
+
{ label: "Seq2Seq (encoder-decoder, e.g. T5, BART, MarianMT)", value: "s2s", default: "t5-base" },
|
| 13 |
+
{ label: "Vision models (image classification, CLIP vision tower, etc.)", value: "vision", default: "google/vit-base-patch16-224" },
|
|
|
|
| 14 |
];
|
| 15 |
|
| 16 |
+
const [modelName, setModelName] = useState("");
|
| 17 |
+
const [selectedOption, setSelectedOption] = useState(options[0].value);
|
| 18 |
+
const [placeholder, setPlaceholder] = useState(options[0].default);
|
| 19 |
+
|
| 20 |
|
| 21 |
const handleFetch = () => {
|
| 22 |
+
const name = modelName && modelName !== "" ? modelName : placeholder;
|
| 23 |
+
fetchModelStructure(name, selectedOption);
|
| 24 |
};
|
| 25 |
|
| 26 |
+
const handelRadioChange = (e) => {
|
| 27 |
+
setSelectedOption(e.target.value);
|
| 28 |
+
const opt = options.find((o) => o.value === e.target.value);
|
| 29 |
+
if (opt) {
|
| 30 |
+
setPlaceholder(opt.default);
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
const [focused, setFocused] = useState(false);
|
| 35 |
+
|
| 36 |
+
return (
|
| 37 |
<div className="flex flex-col gap-2 mb-4 w-full">
|
| 38 |
<div className="flex gap-2 w-full">
|
| 39 |
<input
|
| 40 |
type="text"
|
| 41 |
value={modelName}
|
| 42 |
onChange={(e) => setModelName(e.target.value)}
|
| 43 |
+
placeholder={placeholder}
|
| 44 |
className="flex-1 px-4 py-2 rounded-lg border border-slate-200 focus:outline-none focus:ring-2 focus:ring-sky-300"
|
| 45 |
onKeyDown={(e) => {
|
| 46 |
if (e.key === "Enter") handleFetch();
|
| 47 |
}}
|
| 48 |
+
onFocus={() => setFocused(true)}
|
| 49 |
+
onBlur={() => setFocused(false)}
|
| 50 |
aria-label="Model name"
|
| 51 |
/>
|
| 52 |
|
|
|
|
| 69 |
name="fetchOption"
|
| 70 |
value={option.value}
|
| 71 |
checked={selectedOption === option.value}
|
| 72 |
+
onChange={handelRadioChange}
|
| 73 |
className="w-4 h-4"
|
| 74 |
/>
|
| 75 |
<span>{option.label}</span>
|