Vokturz commited on
Commit
79671b7
·
1 Parent(s): cdf1d8a

AI generated readme file

Browse files
Files changed (1) hide show
  1. README.md +29 -31
README.md CHANGED
@@ -10,49 +10,47 @@ app_file: build/index.html
10
  ---
11
 
12
 
13
- # Getting Started with Create React App
14
 
15
- This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
16
 
17
- ## Available Scripts
18
 
19
- In the project directory, you can run:
20
 
21
- ### `npm start`
22
 
23
- Runs the app in the development mode.\
24
- Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
 
 
 
 
 
 
 
 
25
 
26
- The page will reload if you make edits.\
27
- You will also see any lint errors in the console.
28
 
29
- ### `npm test`
30
 
31
- Launches the test runner in the interactive watch mode.\
32
- See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
33
 
34
- ### `npm run build`
 
 
 
 
35
 
36
- Builds the app for production to the `build` folder.\
37
- It correctly bundles React in production mode and optimizes the build for the best performance.
38
 
39
- The build is minified and the filenames include the hashes.\
40
- Your app is ready to be deployed!
41
 
42
- See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
43
 
44
- ### `npm run eject`
45
 
46
- **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
47
 
48
- If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
49
-
50
- Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
51
-
52
- You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
53
-
54
- ## Learn More
55
-
56
- You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
57
-
58
- To learn React, check out the [React documentation](https://reactjs.org/).
 
10
  ---
11
 
12
 
13
+ # In-Browser AI with Hugging Face Transformers.js
14
 
15
+ This project is a web-based application built with React and TypeScript that demonstrates how to run Hugging Face Transformers models directly in the browser. It leverages the power of the `transformers.js` library to perform various NLP tasks like text generation, text classification, and zero-shot classification without any server-side backend for the model inference.
16
 
17
+ The entire process, from model loading to inference, happens on the client-side, ensuring user privacy and showcasing the capabilities of modern web technologies like Web Workers and WebGPU.
18
 
19
+ -----
20
 
21
+ ## Features
22
 
23
+ * **Multiple Pipelines:** Supports several NLP tasks:
24
+ * Text Generation
25
+ * Text Classification
26
+ * Zero-Shot Classification
27
+ * **Dynamic Model Loading:** Fetches and runs compatible models directly from the Hugging Face Hub based on the selected pipeline.
28
+ * **In-Browser Inference:** All machine learning computations are performed in the user's browser using **Hugging Face Transformers.js**. No data is sent to a server.
29
+ * **Non-Blocking UI:** Uses **Web Workers** to run the heavy model computations in a background thread, ensuring the main UI remains responsive and smooth.
30
+ * **Hardware Acceleration:** Leverages **WebGPU** for significantly faster model performance on supported hardware.
31
+ * **Model Quantization:** Allows users to select different quantization levels (e.g., `fp32`, `int8`) to balance performance and precision.
32
+ * **Modern Tech Stack:** Built with **React**, **TypeScript**, and styled with **Tailwind CSS**.
33
 
34
+ -----
 
35
 
36
+ ## 🏗️ How It Works
37
 
38
+ The application's architecture is designed to offload heavy machine learning tasks from the main UI thread, providing a seamless user experience.
 
39
 
40
+ 1. **Pipeline and Model Selection:** The user first selects an NLP pipeline (e.g., "Text Generation"). The application then calls the Hugging Face Hub API to fetch a list of compatible models for that task.
41
+ 2. **Model Loading via Worker:** When the user selects a model and clicks "Load Model", the main application dispatches a message to a dedicated Web Worker.
42
+ 3. **Background Processing:** The Web Worker, running in a separate thread, receives the message. It uses the `transformers.js` library to download the model files and load the pipeline. This process can be monitored on the UI via progress updates sent from the worker.
43
+ 4. **Inference:** Once the model is loaded, the user can input text. This input is sent to the worker, which performs the inference using the loaded model and WebGPU for acceleration.
44
+ 5. **Displaying Results:** The worker sends the prediction results back to the main thread, which then updates the UI to display the output to the user.
45
 
46
+ This separation of concerns ensures that the computationally intensive work of the AI model does not freeze the user's browser.
 
47
 
48
+ -----
 
49
 
50
+ ## 🚀 Getting Started
51
 
52
+ To get a local copy up and running, follow these simple steps.
53
 
54
+ ### Prerequisites
55
 
56
+ You'll need to have Node.js and npm (or pnpm) installed on your machine.