Download debug_pipeline.py from bayan10/bayan-api: direct link, hf CLI and curl.
- Browser
- Download file 757 Bytes
-
https://huggingface.co/spaces/bayan10/bayan-api/resolve/main/debug_pipeline.py
- Command line
-
hf download hf://spaces/bayan10/bayan-api/debug_pipeline.py
-
curl -L -o debug_pipeline.py https://huggingface.co/spaces/bayan10/bayan-api/resolve/main/debug_pipeline.py
757 Bytes
| import sys | |
| import io | |
| sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') | |
| from pathlib import Path | |
| # Add src to python path | |
| sys.path.insert(0, str(Path(r'c:\Users\dell\PycharmProjects\JupyterProject1\PythonProject\BAYAN\src'))) | |
| from app import app | |
| import json | |
| client = app.test_client() | |
| def test(text): | |
| print(f"\n--- Testing: {text} ---") | |
| resp = client.post('/api/analyze', json={'text': text}) | |
| data = resp.get_json() | |
| if 'suggestions' in data: | |
| for s in data['suggestions']: | |
| print(f"[{s['type'].upper()}] '{s['original']}' -> '{s['correction']}'") | |
| else: | |
| print("Error:", data) | |
| test("ذهبت المهندسون الي العمل") | |
| test("ذهبت المهندسون") | |
| test("الي العمل") | |