Spaces:
Sleeping
Sleeping
Download src/app/components/body/datasets/dataset/dataset.component.ts from uhhlt/CompUGE-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/spaces/uhhlt/CompUGE-Bench/resolve/main/src/app/components/body/datasets/dataset/dataset.component.ts
- Command line
-
hf download hf://spaces/uhhlt/CompUGE-Bench/src/app/components/body/datasets/dataset/dataset.component.ts
-
curl -L -o dataset.component.ts https://huggingface.co/spaces/uhhlt/CompUGE-Bench/resolve/main/src/app/components/body/datasets/dataset/dataset.component.ts
1.47 kB
| import {Component, Input} from '@angular/core'; | |
| import {MatCard, MatCardContent} from "@angular/material/card"; | |
| import {MatButton} from "@angular/material/button"; | |
| import {MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle} from "@angular/material/expansion"; | |
| import {DatasetModel} from "../../../../state_management/models/dataset.model"; | |
| import {NgIf, NgStyle} from "@angular/common"; | |
| ({ | |
| selector: 'app-dataset', | |
| standalone: true, | |
| imports: [ | |
| MatCard, | |
| MatCardContent, | |
| MatButton, | |
| MatExpansionPanel, | |
| MatExpansionPanelHeader, | |
| MatExpansionPanelTitle, | |
| NgIf, | |
| NgStyle | |
| ], | |
| templateUrl: './dataset.component.html', | |
| styleUrl: './dataset.component.css' | |
| }) | |
| export class DatasetComponent { | |
| () | |
| public datasetModel: DatasetModel = { | |
| task: '', | |
| name: '', | |
| description: '', | |
| link: '', | |
| paper: '', | |
| paper_link: '', | |
| train: [], | |
| test: [], | |
| val: [] | |
| }; | |
| getTextDownloadURL(data: string[]) { | |
| return window.URL.createObjectURL(new Blob(data, {type: 'text/plain'})); | |
| } | |
| downloadData(data: string[], name: string) { | |
| const url = this.getTextDownloadURL(data); | |
| const a = document.createElement('a'); | |
| a.href = url; | |
| a.download = this.datasetModel.task + '-' + this.datasetModel.name + '-' + name + '.csv'; | |
| document.body.appendChild(a); | |
| a.click(); | |
| window.URL.revokeObjectURL(url); | |
| } | |
| goToUrl(url: string) { | |
| window.open(url, '_blank'); | |
| } | |
| } | |