--- title: Ai Writer emoji: πŸš€ colorFrom: yellow colorTo: yellow sdk: gradio sdk_version: 6.12.0 app_file: app.py pinned: false license: mit --- # ✍️ AI Writer β€” Professional Text Generation Tool AI Writer is a professional article generation tool that writes text indistinguishable from human-written content. It uses the GLM-5 API for generation and includes a built-in style analyzer, knowledge base system, and strict automated editor. ## Features ### πŸ“š Style Dataset Support Upload up to 100 `.docx` files to build a writing style profile. The system analyzes your writing patterns β€” sentence length, contraction usage, paragraph structure, conjunction starts β€” and replicates your voice in generated text. ### πŸ“– Knowledge Base Upload a `.docx` file with project-specific data. The system uses this information to write accurate articles with real facts, figures, and data from your knowledge base. ### πŸ”‘ Keywords & LSI Keywords Specify target keywords and LSI keywords with exact occurrence counts. Format: `word:count` per line (e.g., `bitcoin:3`). The system ensures each keyword appears the required number of times. ### 🌍 Country & Currency Support Select a country and the system automatically: - Uses the correct currency symbol (β‚Ή, $, €, Β£, etc.) - Places the symbol before the amount - Converts amounts according to exchange rates ### πŸ“ Word Count Control Set minimum and maximum word counts. The editor verifies compliance and adjusts the text if needed. ### 🚫 Strict Content Rules - **No dashes** (β€”, –, -) β€” automatically removed - **No quotation marks** (" ", Β« Β», ' ') β€” automatically removed - **No personal pronouns** (ΠΌΡ‹/наш/Π²Ρ‹/ваш/Ρ‚Ρ‹/Ρ‚Π²ΠΎΠΉ) β€” automatically removed - **Russian language** for main text, configurable language for subheadings and keywords ### ✏️ Two-Pass Editor 1. **Automated editor** β€” removes forbidden characters, replaces currency codes, checks keyword counts 2. **LLM editor** β€” reviews content quality, heading consistency, and compliance with all requirements ### 🧠 Editable System Prompt The core writing instructions are stored in `system_prompt.md` and can be edited directly through the UI or the file. This controls the AI's writing behavior, banned vocabulary, style rules, and process. ## How to Use 1. **βš™οΈ API Settings** β€” Verify your API connection (default token is pre-filled) 2. **πŸ“š Datasets** β€” Upload your `.docx` writing samples to build a style profile 3. **πŸ“– Knowledge Base** β€” Upload project-specific `.docx` data files 4. **πŸ“ Generate Article** β€” Fill in the assignment and click Generate 5. **🧠 System Prompt** β€” Optionally edit the core writing instructions ## API Configuration - **Default endpoint:** `https://api.us-west-2.modal.direct/v1/chat/completions` - **Default model:** `zai-org/GLM-5.1-FP8` - **Default token:** Pre-configured (changeable in API Settings tab) To change the API token: 1. Go to **βš™οΈ API Settings** tab 2. Paste your new token 3. Click **πŸ” Test Connection** See [INSTALL.md](INSTALL.md) for detailed instructions on changing the API key and deployment. ## Deployment on Hugging Face Spaces This application is designed to run on Hugging Face Spaces with the Gradio SDK. 1. Create a new Gradio Space 2. Upload all files from this folder 3. The Space will build and launch automatically ## File Structure ``` β”œβ”€β”€ app.py # Main Gradio application β”œβ”€β”€ requirements.txt # Python dependencies β”œβ”€β”€ system_prompt.md # Editable system prompt (the "brain") β”œβ”€β”€ editor_prompt.md # Editor prompt documentation β”œβ”€β”€ INSTALL.md # Installation & API key guide β”œβ”€β”€ README.md # This file └── utils/ β”œβ”€β”€ __init__.py β”œβ”€β”€ api_client.py # GLM API client β”œβ”€β”€ docx_parser.py # DOCX file parser β”œβ”€β”€ editor.py # Automated editor & currency handler └── style_analyzer.py # Dataset & knowledge base manager ``` ## Supported Countries & Currencies India (β‚Ή), Argentina ($), Bangladesh (ΰ§³), Spain (€), Germany (€), Poland (zΕ‚), France (€), USA ($), UK (Β£), China (Β₯), Japan (Β₯), South Korea (β‚©), Brazil (R$), Mexico ($), Canada ($), Australia ($), Italy (€), Netherlands (€), Belgium (€), Switzerland (CHF), Turkey (β‚Ί), Russia (β‚½), Ukraine (β‚΄), Kazakhstan (β‚Έ), Belarus (Br), UAE (Ψ―.Ψ₯), Saudi Arabia (ο·Ό), Egypt (EΒ£), South Africa (R), Nigeria (₦), Kenya (KSh), Thailand (ΰΈΏ), Vietnam (β‚«), Indonesia (Rp), Philippines (β‚±), Malaysia (RM), Singapore ($), Israel (β‚ͺ), Sweden (kr), Norway (kr), Denmark (kr), Finland (€), Portugal (€), Greece (€), Czech Republic (Kč), Romania (lei), Hungary (Ft), Austria (€), Ireland (€), and more.