--- title: BERT CryptoTalk emoji: ๐Ÿ“ˆ colorFrom: gray colorTo: yellow sdk: gradio sdk_version: 6.14.0 app_file: app.py pinned: false license: mit short_description: BERT-CryptoTalk hf_oauth: true hf_oauth_scopes: - inference-api --- # ๐Ÿช™ CryptoBERT Gradio Inference App 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. --- ## ๐Ÿ“ฆ Features โœ… **CryptoBERT Text Classification** โœ… **Gradio UI with Sidebar & Tabs** โœ… **Dynamic Hugging Face Token Authentication** โœ… **Secure Token Management with .env Support** โœ… **Sample Dataset Preview (AG News)** โœ… **Structured, Testable Python Codebase** โœ… **PEP 8 & Security Best Practices** โœ… **Unit Testing Included** --- ## ๐Ÿ“ธ Demo Preview ![demo-preview](https://user-images.githubusercontent.com/your-demo-image.png) --- ## ๐Ÿš€ Quickstart ### 1๏ธโƒฃ Clone the Repository ```bash git clone https://github.com/your-username/crypto-bert-inference.git cd crypto-bert-inference ``` ### 2๏ธโƒฃ Install Dependencies ```bash pip install -r requirements.txt ``` ### 3๏ธโƒฃ Configure Environment Variables Create a `.env` file: ```bash cp .env.example .env ``` Edit `.env`: ```dotenv HUGGINGFACE_TOKEN=your_huggingface_token_here ``` ### 4๏ธโƒฃ Launch the App ```bash python app.py ``` The Gradio interface will open in your browser. --- ## ๐Ÿ“Š Usage ### ๐Ÿ” Authenticate with Hugging Face - Enter your Hugging Face token in the sidebar - Click `Set Token` to authenticate dynamically ### ๐Ÿ“ Run Crypto Sentiment Inference - Switch to the `CryptoTalk Inference` tab - Enter cryptocurrency-related text - Click `Predict` to view sentiment predictions ### ๐Ÿ“– View Sample Dataset - The sidebar displays a preview sample from the `AG News` dataset for demo purposes --- ## ๐Ÿ—‚๏ธ Project Structure ``` crypto-bert-inference/ โ”œโ”€โ”€ app.py โ”œโ”€โ”€ pipeline_utils.py โ”œโ”€โ”€ .env โ”œโ”€โ”€ requirements.txt โ”œโ”€โ”€ tests/ โ”‚ โ””โ”€โ”€ test_app.py โ””โ”€โ”€ README.md ``` --- ## ๐Ÿงช Run Unit Tests ```bash python -m unittest discover tests ``` --- ## ๐Ÿ“š Dependencies - [transformers](https://github.com/huggingface/transformers) - [gradio](https://gradio.app) - [datasets](https://huggingface.co/docs/datasets) - [python-dotenv](https://github.com/theskumar/python-dotenv) - [requests](https://docs.python-requests.org/en/latest/) --- ## ๐Ÿ“– Documentation - [CryptoBERT Model (kk08/CryptoBERT)](https://huggingface.co/kk08/CryptoBERT) - [Gradio Blocks API](https://www.gradio.app/docs/blocks) - [Hugging Face Authentication API](https://huggingface.co/docs/hub/security-tokens) --- ## ๐Ÿ’ก Future Enhancements - ๐Ÿณ Dockerized deployment - ๐Ÿ“ˆ Inference result charting - ๐ŸŒ Web-hosted demo on Hugging Face Spaces --- ## ๐Ÿ›ก๏ธ Security Considerations - Tokens are stored securely via environment variables - No plaintext token persistence or hardcoding - Input validation handled by Transformers pipelines - Isolated inference processes --- ## ๐Ÿ“œ License MIT ยฉ [Canstralian(https://github.com/canstralian) --- ## ๐Ÿ–ฅ๏ธ Author **[Your Name]** โ€” *Cybersecurity & AI Developer* [GitHub](https://github.com/canstralian) | [LinkedIn](https://www.linkedin.com/in/stephen-de-jager-71b52b29b/) ```