Spaces:
Sleeping
Sleeping
Download tests/conftest.py from bnewcomer/MediBot: direct link, hf CLI and curl.
- Browser
- Download file 889 Bytes
-
https://huggingface.co/spaces/bnewcomer/MediBot/resolve/main/tests/conftest.py
- Command line
-
hf download hf://spaces/bnewcomer/MediBot/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/spaces/bnewcomer/MediBot/resolve/main/tests/conftest.py
889 Bytes
| import importlib.util | |
| import os | |
| import sys | |
| from pathlib import Path | |
| import pytest | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def _load_app_module(): | |
| os.environ.setdefault("OPENAI_API_KEY", "test-key") | |
| if str(ROOT) not in sys.path: | |
| sys.path.insert(0, str(ROOT)) | |
| spec = importlib.util.spec_from_file_location("medibot_app", ROOT / "app.py") | |
| module = importlib.util.module_from_spec(spec) | |
| assert spec.loader is not None | |
| spec.loader.exec_module(module) | |
| return module | |
| def app_module(): | |
| return _load_app_module() | |
| def medibot_app(app_module, monkeypatch): | |
| app = app_module.MedicalChatbotApp() | |
| monkeypatch.setattr( | |
| app.agents["disease_diagnosis"].reranker, | |
| "rerank", | |
| lambda user_symptoms, candidates, collapsed_df, top_k=5: candidates[:top_k], | |
| ) | |
| return app | |