Spaces:
Sleeping
Sleeping
Download main.py from thaidinhz1/rag-vietnamese: direct link, hf CLI and curl.
- Browser
- Download file 585 Bytes
-
https://huggingface.co/spaces/thaidinhz1/rag-vietnamese/resolve/main/main.py
- Command line
-
hf download hf://spaces/thaidinhz1/rag-vietnamese/main.py
-
curl -L -o main.py https://huggingface.co/spaces/thaidinhz1/rag-vietnamese/resolve/main/main.py
585 Bytes
| from src.rag import answer | |
| if __name__ == "__main__": | |
| print("=== RAG CLI ===") | |
| print("Gõ 'quit' để thoát\n") | |
| while True: | |
| question = input("Câu hỏi: ").strip() | |
| if question.lower() in ("quit", "exit", "q"): | |
| break | |
| if not question: | |
| continue | |
| result = answer(question) | |
| print(f"\nTrả lời: {result['answer']}") | |
| print("\nNguồn:") | |
| for s in result["sources"]: | |
| print(f" - {s['source']} (trang {s['page']}, rrf: {s['rrf_score']}, rerank: {s['rerank_score']})") | |
| print() | |