-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new dynalab with HF integration (#235)
* feat: add new dynalab * feat: add new submit interface
- Loading branch information
Showing
12 changed files
with
602 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
backend/app/domain/services/builder_and_evaluation/builder_hf.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) MLCommons and its affiliates. | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
|
||
class BuilderHF: | ||
def __init__(self): | ||
pass | ||
|
||
def get_ip_model(self): | ||
""" | ||
This should return an ip, model name, folder_name, arn_service | ||
as None and repo_name as None | ||
""" | ||
pass | ||
|
||
def download_model(self, url: str) -> None: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
frontends/web/src/new_front/components/Buttons/ProgressBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from "react"; | ||
|
||
const ProgressBar = ({ | ||
progress, | ||
text, | ||
}: { | ||
progress: number; | ||
text: string; | ||
}) => { | ||
return ( | ||
<div | ||
className="center-loading" | ||
style={{ | ||
width: "50%", | ||
}} | ||
> | ||
<h3> Please do not close this window</h3> | ||
<p> | ||
The upload depends on the size of the model and your internet | ||
connection, please be patient 😊 | ||
</p> | ||
<div className="progress"> | ||
<div | ||
className="progress-bar progress-bar-striped progress-bar-animated" | ||
role="progressbar" | ||
style={{ width: `${progress * 100}%` }} | ||
></div> | ||
</div> | ||
<h6> | ||
{progress > 0 && progress < 0.5 | ||
? text | ||
: progress >= 0.5 | ||
? "We are processing your model" | ||
: ""} | ||
</h6> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProgressBar; |
70 changes: 70 additions & 0 deletions
70
frontends/web/src/new_front/components/DragAndDrop/FileUpload.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React, { ChangeEvent } from "react"; | ||
import { useDropzone } from "react-dropzone"; | ||
|
||
interface FileUploadProps { | ||
fileName?: string | undefined; | ||
setFileName: React.Dispatch<React.SetStateAction<string | undefined>>; | ||
handleChange: (e: ChangeEvent<HTMLInputElement>) => void; | ||
register: any; // Adjust the type of register according to your useForm usage | ||
} | ||
|
||
const FileUpload: React.FC<FileUploadProps> = ({ | ||
fileName, | ||
setFileName, | ||
handleChange, | ||
register, | ||
}) => { | ||
const { getRootProps, getInputProps, isDragActive } = useDropzone({ | ||
accept: { | ||
"application/pdf": [".zip"], | ||
}, | ||
onDrop: (acceptedFiles) => { | ||
if (acceptedFiles.length > 0) { | ||
setFileName(acceptedFiles[0].name); | ||
register("file", { value: acceptedFiles[0] }); | ||
} | ||
}, | ||
maxFiles: 1, | ||
}); | ||
|
||
return ( | ||
<div className="max-w-md mx-auto"> | ||
{fileName ? ( | ||
<div className="mb-4"> | ||
<div className="p-4 bg-white border rounded-md shadow-md"> | ||
<div className="flex items-center justify-between gap-3"> | ||
<div className="">{fileName}</div> | ||
<button | ||
className="pt-1 text-red-500 hover:text-red-700" | ||
onClick={() => setFileName(undefined)} | ||
> | ||
Delete | ||
</button> | ||
</div> | ||
</div> | ||
<div className="mt-4"> | ||
<input | ||
{...getInputProps()} | ||
onChange={handleChange} | ||
className="hidden" | ||
/> | ||
</div> | ||
</div> | ||
) : ( | ||
<div | ||
{...getRootProps()} | ||
className={`bg-white border border-dashed rounded-md p-8 text-center ${ | ||
isDragActive ? "border-blue-500" : "" | ||
}`} | ||
> | ||
<input {...getInputProps()} onChange={handleChange} /> | ||
<p className="text-gray-600"> | ||
Drag & drop your zip model here, or click to select a zip model | ||
</p> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default FileUpload; |
Oops, something went wrong.