JanviMl commited on
Commit
96e24c3
·
verified ·
1 Parent(s): dd76a5e

Create Abouttheproject

Browse files
Files changed (1) hide show
  1. Abouttheproject +41 -0
Abouttheproject ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ToxiScan
2
+
3
+ ToxiScan is a Hugging Face Space application that classifies images as toxic or non-toxic using a pre-trained Vision Transformer (ViT) model from Hugging Face. Built with Streamlit, it provides a user-friendly interface for uploading images and viewing classification results.
4
+
5
+ ## Features
6
+ - **Image Upload:** Users can upload images (JPG, PNG, JPEG) via the Streamlit frontend.
7
+ - **Toxic Classification:** Leverages a pre-trained ViT model (`google/vit-base-patch16-224`) to predict if an image is toxic or non-toxic.
8
+ - **Results Display:** Shows the prediction label (Toxic/Non-Toxic), confidence scores, and a bar chart visualization.
9
+ - **Deployment:** Hosted entirely on Hugging Face Spaces.
10
+
11
+ ## Project Structure
12
+ - **`app.py`**: Main Streamlit application that handles the frontend and backend logic.
13
+ - **`utils.py`**: Helper functions for image processing and prediction with ViT.
14
+ - **`requirements.txt`**: Lists Python dependencies for the project.
15
+ - **`data/`**: Optional folder with `train/` and `test/` subfolders as placeholders for a dataset (not required for basic functionality).
16
+ - **`toxic_classifier.pth`** (optional): Fine-tuned model weights for accurate toxic detection (upload separately).
17
+
18
+ ## How It Works
19
+ 1. **Upload:** Users upload an image through the Streamlit interface.
20
+ 2. **Processing:** The app uses a pre-trained ViT model to process the image.
21
+ 3. **Prediction:** The model outputs a binary classification (toxic or non-toxic) with confidence scores.
22
+ 4. **Display:** Results are shown with the uploaded image, prediction label, confidence percentages, and a bar chart.
23
+
24
+ ## Setup on Hugging Face
25
+ 1. **Create Space:**
26
+ - Name: `ToxiScan`
27
+ - SDK: `Streamlit`
28
+ - Visibility: Public or Private
29
+ 2. **Upload Files:**
30
+ - Push all files via Git (see deployment steps below).
31
+ 3. **Fine-tuning (Optional):**
32
+ - Fine-tune the ViT model locally with a toxic/non-toxic dataset and upload `toxic_classifier.pth`.
33
+
34
+ ## Deployment Steps
35
+ ```bash
36
+ # On your local machine
37
+ git init
38
+ git add .
39
+ git commit -m "Initial ToxiScan setup with Streamlit"
40
+ git remote add origin https://huggingface.co/spaces/JanviMl/ToxiScan
41
+ git push https://JanviMl:hf_<your-token>@huggingface.co/spaces/JanviMl/ToxiScan main