Update README.md
Browse files
README.md
CHANGED
|
@@ -10,3 +10,82 @@ pinned: false
|
|
| 10 |
---
|
| 11 |
|
| 12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 13 |
+
|
| 14 |
+
## NLP App Hugging Face's logo
|
| 15 |
+
Hugging Face
|
| 16 |
+
# Streamlit app with computer vision 💡
|
| 17 |
+
Elbrus Bootcamp | Phase-2 | Team Project
|
| 18 |
+
|
| 19 |
+
## Team🧑🏻💻
|
| 20 |
+
1. [Awlly](https://github.com/Awlly)
|
| 21 |
+
2. [sakoser](https://github.com/sakoser)
|
| 22 |
+
3. [whoisida]https://github.com/whoisida
|
| 23 |
+
|
| 24 |
+
## Task 📌lassifi
|
| 25 |
+
Create a service that classifies movie reviews into good, neutral and bad categories, a service that classifies user input as toxic or non-toxic, as well as a GPT 2 based text generation service that was trained to emulate a certain author’s writing.
|
| 26 |
+
|
| 27 |
+
## Contents 📝
|
| 28 |
+
1. Classifies movie reviewsusing LSTM,ruBert,BOW 💨 [Dataset](https://drive.google.com/file/d/1c92sz81bEfOw-rutglKpmKGm6rySmYbt/view?usp=sharing)
|
| 29 |
+
2. classifies user input as toxic or non-toxi using ruBert-tiny-toxicity 📑 [Dataset](https://drive.google.com/file/d/1O7orH9CrNEhnbnA5KjXji8sgrn6iD5n-/view?usp=drive_link)
|
| 30 |
+
3. GPT 2 based text generation service
|
| 31 |
+
|
| 32 |
+
## Deployment 🎈
|
| 33 |
+
The service is implemented on [Hugging Face](https://huggingface.co/spaces/Awlly/NLP_app)
|
| 34 |
+
|
| 35 |
+
## Libraries 📖
|
| 36 |
+
```python
|
| 37 |
+
import os
|
| 38 |
+
import unicodedata
|
| 39 |
+
import nltk
|
| 40 |
+
from dataclasses import dataclass
|
| 41 |
+
import joblib
|
| 42 |
+
import numpy as np
|
| 43 |
+
import matplotlib.pyplot as plt
|
| 44 |
+
import torch
|
| 45 |
+
import torch.nn as nn
|
| 46 |
+
import torch.nn.functional as F
|
| 47 |
+
import torch.optim as optim
|
| 48 |
+
from torch.utils.data import DataLoader, TensorDataset
|
| 49 |
+
from torchvision.datasets import ImageFolder
|
| 50 |
+
from torchvision import datasets
|
| 51 |
+
from torchvision import transforms as T
|
| 52 |
+
from torchvision.io import read_image
|
| 53 |
+
from torch.utils.data import Dataset, random_split
|
| 54 |
+
import torchutils as tu
|
| 55 |
+
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
| 56 |
+
from typing import Tuple
|
| 57 |
+
from tqdm import tqdm
|
| 58 |
+
from transformers import AutoModel, AutoTokenizer
|
| 59 |
+
from transformers import AutoModelForSequenceClassification
|
| 60 |
+
import pydensecrf.densecrf as dcrf
|
| 61 |
+
import pydensecrf.utils as dcrf_utils
|
| 62 |
+
from preprocessing import data_preprocessing
|
| 63 |
+
import streamlit as st
|
| 64 |
+
import string
|
| 65 |
+
from sklearn.linear_model import LogisticRegression
|
| 66 |
+
import re
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
from preprocessing import preprocess_single_string
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
from preprocessing import data_preprocessing
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
## Guide 📜
|
| 81 |
+
#### How to run locally?
|
| 82 |
+
|
| 83 |
+
1. To create a Python virtual environment for running the code, enter:
|
| 84 |
+
|
| 85 |
+
``python3 -m venv my-env``
|
| 86 |
+
|
| 87 |
+
2. Activate the new environment:
|
| 88 |
+
|
| 89 |
+
* Windows: ```my-env\Scripts\activate.bat```
|
| 90 |
+
* macOS and Linux: ```source my-env/bin/activate```
|
| 91 |
+
|