Spaces:
Runtime error
Runtime error
mwitiderrick
commited on
Commit
•
eeb5ca9
1
Parent(s):
dcd3a45
Update app.py
Browse files
app.py
CHANGED
@@ -7,9 +7,11 @@ markdownn = '''
|
|
7 |
Text Classification involves assigning a label to a given text. For example, sentiment analysis is an example of a text classification use case.
|
8 |
![Text Classification Pipeline with DeepSparse](https://huggingface.co/spaces/neuralmagic/nlp-text-classification/resolve/main/text-classification.png)
|
9 |
## What is DeepSparse
|
10 |
-
DeepSparse is
|
|
|
|
|
11 |
The text classification Pipeline, for example, wraps an NLP model with the proper preprocessing and postprocessing pipelines, such as tokenization.
|
12 |
-
### Inference
|
13 |
Here is sample code for a text classification pipeline:
|
14 |
```
|
15 |
from deepsparse import Pipeline
|
@@ -17,7 +19,7 @@ pipeline = Pipeline.create(task="zero_shot_text_classification", model_path="zoo
|
|
17 |
inference = pipeline(sequences= text,labels=['politics', 'public health', 'Europe'],)
|
18 |
print(inference)
|
19 |
```
|
20 |
-
## Use
|
21 |
Customer review classification is a great example of text classification in action.
|
22 |
|
23 |
The ability to quickly classify sentiment from customers is an added advantage for any business.
|
@@ -25,8 +27,9 @@ Therefore, whichever solution you deploy for classifying the customer reviews sh
|
|
25 |
By being fast the solution will process more volume, hence cheaper computational resources are utilized.
|
26 |
|
27 |
When deploying a text classification model, decreasing the model’s latency and increasing its throughput is critical. This is why DeepSparse Pipelines have sparse text classification models.
|
28 |
-
|
29 |
-
[
|
|
|
30 |
'''
|
31 |
task = "zero_shot_text_classification"
|
32 |
dense_classification_pipeline = Pipeline.create(
|
|
|
7 |
Text Classification involves assigning a label to a given text. For example, sentiment analysis is an example of a text classification use case.
|
8 |
![Text Classification Pipeline with DeepSparse](https://huggingface.co/spaces/neuralmagic/nlp-text-classification/resolve/main/text-classification.png)
|
9 |
## What is DeepSparse
|
10 |
+
DeepSparse is an inference runtime offering GPU-class performance on CPUs and APIs to integrate ML into your application. Sparsification is a powerful technique for optimizing models for inference, reducing the compute needed with a limited accuracy tradeoff. DeepSparse is designed to take advantage of model sparsity, enabling you to deploy models with the flexibility and scalability of software on commodity CPUs with the best-in-class performance of hardware accelerators, enabling you to standardize operations and reduce infrastructure costs.
|
11 |
+
Similar to Hugging Face, DeepSparse provides off-the-shelf pipelines for computer vision and NLP that wrap the model with proper pre- and post-processing to run performantly on CPUs by using sparse models.
|
12 |
+
|
13 |
The text classification Pipeline, for example, wraps an NLP model with the proper preprocessing and postprocessing pipelines, such as tokenization.
|
14 |
+
### Inference API Example
|
15 |
Here is sample code for a text classification pipeline:
|
16 |
```
|
17 |
from deepsparse import Pipeline
|
|
|
19 |
inference = pipeline(sequences= text,labels=['politics', 'public health', 'Europe'],)
|
20 |
print(inference)
|
21 |
```
|
22 |
+
## Use Case Description
|
23 |
Customer review classification is a great example of text classification in action.
|
24 |
|
25 |
The ability to quickly classify sentiment from customers is an added advantage for any business.
|
|
|
27 |
By being fast the solution will process more volume, hence cheaper computational resources are utilized.
|
28 |
|
29 |
When deploying a text classification model, decreasing the model’s latency and increasing its throughput is critical. This is why DeepSparse Pipelines have sparse text classification models.
|
30 |
+
|
31 |
+
[Want to train a sparse model on your data? Checkout the documentation on sparse transfer learning](https://docs.neuralmagic.com/use-cases/natural-language-processing/question-answering)
|
32 |
+
|
33 |
'''
|
34 |
task = "zero_shot_text_classification"
|
35 |
dense_classification_pipeline = Pipeline.create(
|