mwitiderrick commited on
Commit
5cd3b27
1 Parent(s): 0f8b50e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -6,15 +6,19 @@ markdownn = '''
6
  # Text Classification Pipeline with DeepSparse
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
- ![Text Classification Pipeline with DeepSparse](https://huggingface.co/spaces/neuralmagic/nlp-text-classification/resolve/main/text-classification.png)
10
  DeepSparse is sparsity-aware inference runtime offering GPU-class performance on CPUs and APIs to integrate ML into your application. DeepSparse provides sparsified pipelines for computer vision and NLP.
11
- The text classification Pipeline, for example, wraps an NLP model with the proper preprocessing and postprocessing pipelines, such as tokenization. Here is sample code for a text classification pipeline:
 
 
12
  ```
13
  from deepsparse import Pipeline
14
  pipeline = Pipeline.create(task="zero_shot_text_classification", model_path="zoo:nlp/text_classification/distilbert-none/pytorch/huggingface/mnli/pruned80_quant-none-vnni",model_scheme="mnli",model_config={"hypothesis_template": "This text is related to {}"},)
15
  inference = pipeline(sequences= text,labels=['politics', 'public health', 'Europe'],)
16
  print(inference)
17
  ```
 
 
18
  '''
19
  task = "zero_shot_text_classification"
20
  dense_classification_pipeline = Pipeline.create(
 
6
  # Text Classification Pipeline with DeepSparse
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 sparsity-aware inference runtime offering GPU-class performance on CPUs and APIs to integrate ML into your application. DeepSparse provides sparsified pipelines for computer vision and NLP.
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
16
  pipeline = Pipeline.create(task="zero_shot_text_classification", model_path="zoo:nlp/text_classification/distilbert-none/pytorch/huggingface/mnli/pruned80_quant-none-vnni",model_scheme="mnli",model_config={"hypothesis_template": "This text is related to {}"},)
17
  inference = pipeline(sequences= text,labels=['politics', 'public health', 'Europe'],)
18
  print(inference)
19
  ```
20
+ ## Resources
21
+ [Classify Even Longer Customer Reviews Using Sparsity with DeepSparse](https://neuralmagic.com/blog/accelerate-customer-review-classification-with-sparse-transformers/)
22
  '''
23
  task = "zero_shot_text_classification"
24
  dense_classification_pipeline = Pipeline.create(