| --- |
| title: Sinhala SRT Subtitle Cleaner |
| emoji: 🎬 |
| colorFrom: blue |
| colorTo: purple |
| sdk: gradio |
| sdk_version: "4.44.0" |
| app_file: app.py |
| pinned: false |
| license: mit |
| --- |
| |
| # 🎬 සිංහල SRT Subtitle Cleaner |
|
|
| Gemma 2 9B AI model භාවිතා කර .srt subtitle files වලින් author credits, website URLs, සහ copyright notices ස්වයංක්රීයව ඉවත් කරයි. |
|
|
| ## ✨ Features |
|
|
| - **Dual Detection:** Regex fast-filter + Gemma 2 9B AI classification |
| - **Live Interface:** File upload හෝ text paste කළ හැකිය |
| - **API Endpoint:** Python/cURL හරහා programmatic access |
| - **Renumbering:** ඉවත් කළ lines වලින් පසු automatic renumbering |
| - **Sinhala Support:** UTF-8 encoding සම්පූර්ණයෙන් support කරයි |
|
|
| ## 🚀 Setup |
|
|
| ### HF Token |
| Space Settings > Variables and Secrets හි: |
| ``` |
| HF_TOKEN = hf_xxxxxxxxxxxxxxxx |
| ``` |
| Gemma 2 access සඳහා [model page](https://huggingface.co/google/gemma-2-9b-it) හි access request කරන්න. |
|
|
| ## 🔌 API Usage |
|
|
| ```python |
| from gradio_client import Client |
| |
| client = Client("your-username/srt-cleaner") |
| |
| # Text input API |
| result = client.predict( |
| text_content="1\n00:00:01,000 --> 00:00:04,000\nwww.subscene.com\n\n2\n...", |
| use_gemma=True, |
| api_name="/handle_text_input" |
| ) |
| cleaned_srt, report, output_file = result |
| ``` |
|
|
| ## 📋 What Gets Removed? |
|
|
| - Website URLs (http://, www.) |
| - Subtitle site names (Subscene, OpenSubtitles, etc.) |
| - "Subtitles by / Translated by / Synced by" credits |
| - Copyright notices (©, All rights reserved) |
| - Promotional content detected by Gemma AI |
|
|