File size: 5,050 Bytes
b2ecf7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
096c59d
b2ecf7d
 
 
 
 
 
 
 
 
 
 
 
6c7ce80
 
b2ecf7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
096c59d
b2ecf7d
 
 
 
 
 
 
 
6c7ce80
 
b2ecf7d
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<script lang="ts">
	import type { SvelteComponent } from "svelte";

	import IconAudioClassification from "../Icons/IconAudioClassification.svelte";
	import IconAudioToAudio from "../Icons/IconAudioToAudio.svelte";
	import IconAutomaticSpeechRecognition from "../Icons/IconAutomaticSpeechRecognition.svelte";
	import IconConversational from "../Icons/IconConversational.svelte";
	import IconFeatureExtraction from "../Icons/IconFeatureExtraction.svelte";
	import IconFillMask from "../Icons/IconFillMask.svelte";
	import IconImageClassification from "../Icons/IconImageClassification.svelte";
	import IconImageSegmentation from "../Icons/IconImageSegmentation.svelte";
	import IconObjectDetection from "../Icons/IconObjectDetection.svelte";
	import IconDepthEstimation from "../Icons/IconDepthEstimation.svelte";
	import IconVideoClassification from "../Icons/IconVideoClassification.svelte";
	import IconQuestionAnswering from "../Icons/IconQuestionAnswering.svelte";
	import IconSentenceSimilarity from "../Icons/IconSentenceSimilarity.svelte";
	import IconTabularClassification from "../Icons/IconTabularClassification.svelte";
	import IconTabularRegression from "../Icons/IconTabularRegression.svelte";
	import IconSummarization from "../Icons/IconSummarization.svelte";
	import IconTableQuestionAnswering from "../Icons/IconTableQuestionAnswering.svelte";
	import IconText2textGeneration from "../Icons/IconText2textGeneration.svelte";
	import IconTextClassification from "../Icons/IconTextClassification.svelte";
	import IconTextGeneration from "../Icons/IconTextGeneration.svelte";
	import IconTextToImage from "../Icons/IconTextToImage.svelte";
	import IconImageToText from "../Icons/IconImageToText.svelte";
	import IconImageToVideo from "../Icons/IconImageToVideo.svelte";
	import IconTextToSpeech from "../Icons/IconTextToSpeech.svelte";
	import IconTextToVideo from "../Icons/IconTextToVideo.svelte";
	import IconTokenClassification from "../Icons/IconTokenClassification.svelte";
	import IconTranslation from "../Icons/IconTranslation.svelte";
	import IconVoiceActivityDetection from "../Icons/IconVoiceActivityDetection.svelte";
	import IconZeroShotClassification from "../Icons/IconZeroShotClassification.svelte";
	import IconReinforcementLearning from "../Icons/IconReinforcementLearning.svelte";
	import IconRobotics from "../Icons/IconRobotics.svelte";
	import IconImageToImage from "../Icons/IconImageToImage.svelte";
	import IconUnconditionalImageGeneration from "../Icons/IconUnconditionalImageGeneration.svelte";
	import IconDocumentQuestionAnswering from "../Icons/IconDocumentQuestionAnswering.svelte";
	import IconGraphML from "../Icons/IconGraphML.svelte";
	import IconZeroShotObjectDetection from "../Icons/IconZeroShotClassification.svelte";
	import IconMaskGeneration from "../Icons/IconMaskGeneration.svelte";
	import type { PipelineType } from "@huggingface/tasks";

	export let classNames = "";
	export let pipeline = "";

	const ICON_COMPONENTS: {
		[key in PipelineType]?: typeof SvelteComponent;
	} = {
		/// Keep same order as in huggingface_hub/Types.ts
		/// for easy mapping.
		"text-classification": IconTextClassification,
		"token-classification": IconTokenClassification,
		"table-question-answering": IconTableQuestionAnswering,
		"question-answering": IconQuestionAnswering,
		"zero-shot-classification": IconZeroShotClassification,
		translation: IconTranslation,
		summarization: IconSummarization,
		conversational: IconConversational,
		"feature-extraction": IconFeatureExtraction,
		"text-generation": IconTextGeneration,
		"text2text-generation": IconText2textGeneration,
		"fill-mask": IconFillMask,
		"sentence-similarity": IconSentenceSimilarity,
		"text-to-speech": IconTextToSpeech,
		"text-to-audio": IconTextToSpeech,
		"automatic-speech-recognition": IconAutomaticSpeechRecognition,
		"audio-to-audio": IconAudioToAudio,
		"audio-classification": IconAudioClassification,
		"voice-activity-detection": IconVoiceActivityDetection,
		"depth-estimation": IconDepthEstimation,
		"image-classification": IconImageClassification,
		"object-detection": IconObjectDetection,
		"video-classification": IconVideoClassification,
		"image-segmentation": IconImageSegmentation,
		"text-to-image": IconTextToImage,
		"image-to-text": IconImageToText,
		"image-to-image": IconImageToImage,
		"image-to-video": IconImageToVideo,
		"unconditional-image-generation": IconUnconditionalImageGeneration,
		"reinforcement-learning": IconReinforcementLearning,
		robotics: IconRobotics,
		"graph-ml": IconGraphML,
		"tabular-classification": IconTabularClassification,
		"tabular-regression": IconTabularRegression,
		"text-to-video": IconTextToVideo,
		"document-question-answering": IconDocumentQuestionAnswering,
		"mask-generation": IconMaskGeneration,
		"zero-shot-object-detection": IconZeroShotObjectDetection,
	};

	$: iconComponent =
		pipeline in ICON_COMPONENTS ? ICON_COMPONENTS[pipeline as keyof typeof ICON_COMPONENTS] : IconFillMask;
</script>

<svelte:component this={iconComponent} {classNames} />