S-Dreamer commited on
Commit
66c202a
Β·
verified Β·
1 Parent(s): 9e148c4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +147 -2
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: πŸ“ˆ
4
  colorFrom: gray
5
  colorTo: yellow
6
  sdk: gradio
7
- sdk_version: 5.24.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
@@ -14,4 +14,149 @@ hf_oauth_scopes:
14
  - inference-api
15
  ---
16
 
17
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  colorFrom: gray
5
  colorTo: yellow
6
  sdk: gradio
7
+ sdk_version: 5.25.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
14
  - inference-api
15
  ---
16
 
17
+ # πŸͺ™ CryptoBERT Gradio Inference App
18
+
19
+ A clean, modern Gradio interface for **CryptoBERT**, a fine-tuned BERT model for cryptocurrency-related text classification β€” complete with Hugging Face authentication management, dynamic token updates, and integrated sample dataset previews.
20
+
21
+ ---
22
+
23
+ ## πŸ“¦ Features
24
+
25
+ βœ… **CryptoBERT Text Classification**
26
+ βœ… **Gradio UI with Sidebar & Tabs**
27
+ βœ… **Dynamic Hugging Face Token Authentication**
28
+ βœ… **Secure Token Management with .env Support**
29
+ βœ… **Sample Dataset Preview (AG News)**
30
+ βœ… **Structured, Testable Python Codebase**
31
+ βœ… **PEP 8 & Security Best Practices**
32
+ βœ… **Unit Testing Included**
33
+
34
+ ---
35
+
36
+ ## πŸ“Έ Demo Preview
37
+
38
+ ![demo-preview](https://user-images.githubusercontent.com/your-demo-image.png)
39
+
40
+ ---
41
+
42
+ ## πŸš€ Quickstart
43
+
44
+ ### 1️⃣ Clone the Repository
45
+ ```bash
46
+ git clone https://github.com/your-username/crypto-bert-inference.git
47
+ cd crypto-bert-inference
48
+ ```
49
+
50
+ ### 2️⃣ Install Dependencies
51
+ ```bash
52
+ pip install -r requirements.txt
53
+ ```
54
+
55
+ ### 3️⃣ Configure Environment Variables
56
+
57
+ Create a `.env` file:
58
+ ```bash
59
+ cp .env.example .env
60
+ ```
61
+
62
+ Edit `.env`:
63
+ ```dotenv
64
+ HUGGINGFACE_TOKEN=your_huggingface_token_here
65
+ ```
66
+
67
+ ### 4️⃣ Launch the App
68
+ ```bash
69
+ python app.py
70
+ ```
71
+
72
+ The Gradio interface will open in your browser.
73
+
74
+ ---
75
+
76
+ ## πŸ“Š Usage
77
+
78
+ ### πŸ” Authenticate with Hugging Face
79
+ - Enter your Hugging Face token in the sidebar
80
+ - Click `Set Token` to authenticate dynamically
81
+
82
+ ### πŸ“ Run Crypto Sentiment Inference
83
+ - Switch to the `CryptoTalk Inference` tab
84
+ - Enter cryptocurrency-related text
85
+ - Click `Predict` to view sentiment predictions
86
+
87
+ ### πŸ“– View Sample Dataset
88
+ - The sidebar displays a preview sample from the `AG News` dataset for demo purposes
89
+
90
+ ---
91
+
92
+ ## πŸ—‚οΈ Project Structure
93
+
94
+ ```
95
+ crypto-bert-inference/
96
+ β”œβ”€β”€ app.py
97
+ β”œβ”€β”€ pipeline_utils.py
98
+ β”œβ”€β”€ .env
99
+ β”œβ”€β”€ requirements.txt
100
+ β”œβ”€β”€ tests/
101
+ β”‚ └── test_app.py
102
+ └── README.md
103
+ ```
104
+
105
+ ---
106
+
107
+ ## πŸ§ͺ Run Unit Tests
108
+
109
+ ```bash
110
+ python -m unittest discover tests
111
+ ```
112
+
113
+ ---
114
+
115
+ ## πŸ“š Dependencies
116
+
117
+ - [transformers](https://github.com/huggingface/transformers)
118
+ - [gradio](https://gradio.app)
119
+ - [datasets](https://huggingface.co/docs/datasets)
120
+ - [python-dotenv](https://github.com/theskumar/python-dotenv)
121
+ - [requests](https://docs.python-requests.org/en/latest/)
122
+
123
+ ---
124
+
125
+ ## πŸ“– Documentation
126
+
127
+ - [CryptoBERT Model (kk08/CryptoBERT)](https://huggingface.co/kk08/CryptoBERT)
128
+ - [Gradio Blocks API](https://www.gradio.app/docs/blocks)
129
+ - [Hugging Face Authentication API](https://huggingface.co/docs/hub/security-tokens)
130
+
131
+ ---
132
+
133
+ ## πŸ’‘ Future Enhancements
134
+
135
+ - 🐳 Dockerized deployment
136
+ - πŸ“ˆ Inference result charting
137
+ - 🌐 Web-hosted demo on Hugging Face Spaces
138
+
139
+ ---
140
+
141
+ ## πŸ›‘οΈ Security Considerations
142
+
143
+ - Tokens are stored securely via environment variables
144
+ - No plaintext token persistence or hardcoding
145
+ - Input validation handled by Transformers pipelines
146
+ - Isolated inference processes
147
+
148
+ ---
149
+
150
+ ## πŸ“œ License
151
+
152
+ MIT Β© [Your Name](https://github.com/your-username)
153
+
154
+ ---
155
+
156
+ ## πŸ–₯️ Author
157
+
158
+ **[Your Name]** β€” *Cybersecurity & AI Developer*
159
+ [GitHub](https://github.com/canstralian) | [LinkedIn](https://www.linkedin.com/in/stephen-de-jager-71b52b29b/)
160
+
161
+ ```
162
+