Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
machineuser
commited on
Commit
•
58b8b64
1
Parent(s):
16601c5
Sync widgets demo
Browse files
packages/tasks/src/snippets/inputs.ts
CHANGED
@@ -79,6 +79,9 @@ const inputsTextToAudio = () => `"liquid drum and bass, atmospheric synths, airy
|
|
79 |
|
80 |
const inputsAutomaticSpeechRecognition = () => `"sample1.flac"`;
|
81 |
|
|
|
|
|
|
|
82 |
const inputsZeroShotImageClassification = () => `"cats.jpg"`;
|
83 |
|
84 |
const modelInputSnippets: {
|
@@ -98,6 +101,8 @@ const modelInputSnippets: {
|
|
98 |
"sentence-similarity": inputsSentenceSimilarity,
|
99 |
summarization: inputsSummarization,
|
100 |
"table-question-answering": inputsTableQuestionAnswering,
|
|
|
|
|
101 |
"text-classification": inputsTextClassification,
|
102 |
"text-generation": inputsTextGeneration,
|
103 |
"text-to-image": inputsTextToImage,
|
|
|
79 |
|
80 |
const inputsAutomaticSpeechRecognition = () => `"sample1.flac"`;
|
81 |
|
82 |
+
const inputsTabularPrediction = () =>
|
83 |
+
`'{"Height":[11.52,12.48],"Length1":[23.2,24.0],"Length2":[25.4,26.3],"Species": ["Bream","Bream"]}'`;
|
84 |
+
|
85 |
const inputsZeroShotImageClassification = () => `"cats.jpg"`;
|
86 |
|
87 |
const modelInputSnippets: {
|
|
|
101 |
"sentence-similarity": inputsSentenceSimilarity,
|
102 |
summarization: inputsSummarization,
|
103 |
"table-question-answering": inputsTableQuestionAnswering,
|
104 |
+
"tabular-regression": inputsTabularPrediction,
|
105 |
+
"tabular-classification": inputsTabularPrediction,
|
106 |
"text-classification": inputsTextClassification,
|
107 |
"text-generation": inputsTextGeneration,
|
108 |
"text-to-image": inputsTextToImage,
|
packages/tasks/src/snippets/python.ts
CHANGED
@@ -58,6 +58,14 @@ import io
|
|
58 |
from PIL import Image
|
59 |
image = Image.open(io.BytesIO(image_bytes))`;
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
export const snippetTextToAudio = (model: ModelData): string => {
|
62 |
// Transformers TTS pipeline and api-inference-community (AIC) pipeline outputs are diverged
|
63 |
// with the latest update to inference-api (IA).
|
@@ -108,6 +116,8 @@ export const pythonSnippets: Partial<Record<PipelineType, (model: ModelData) =>
|
|
108 |
"audio-to-audio": snippetFile,
|
109 |
"audio-classification": snippetFile,
|
110 |
"image-classification": snippetFile,
|
|
|
|
|
111 |
"object-detection": snippetFile,
|
112 |
"image-segmentation": snippetFile,
|
113 |
"image-to-text": snippetFile,
|
|
|
58 |
from PIL import Image
|
59 |
image = Image.open(io.BytesIO(image_bytes))`;
|
60 |
|
61 |
+
export const snippetTabular = (model: ModelData): string =>
|
62 |
+
`def query(payload):
|
63 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
64 |
+
return response.content
|
65 |
+
response = query({
|
66 |
+
"inputs": {"data": ${getModelInputSnippet(model)}},
|
67 |
+
})`;
|
68 |
+
|
69 |
export const snippetTextToAudio = (model: ModelData): string => {
|
70 |
// Transformers TTS pipeline and api-inference-community (AIC) pipeline outputs are diverged
|
71 |
// with the latest update to inference-api (IA).
|
|
|
116 |
"audio-to-audio": snippetFile,
|
117 |
"audio-classification": snippetFile,
|
118 |
"image-classification": snippetFile,
|
119 |
+
"tabular-regression": snippetTabular,
|
120 |
+
"tabular-classification": snippetTabular,
|
121 |
"object-detection": snippetFile,
|
122 |
"image-segmentation": snippetFile,
|
123 |
"image-to-text": snippetFile,
|