predict.py 880 B

1234567891011121314151617181920212223242526
  1. """
  2. This examples demonstrates the setup for Question-Answer-Retrieval.
  3. You can input a query or a question. The script then uses semantic search
  4. to find relevant passages in Simple English Wikipedia (as it is smaller and fits better in RAM).
  5. As model, we use: nq-distilbert-base-v1
  6. It was trained on the Natural Questions dataset, a dataset with real questions from Google Search
  7. together with annotated data from Wikipedia providing the answer. For the passages, we encode the
  8. Wikipedia article tile together with the individual text passages.
  9. Google Colab Example: https://colab.research.google.com/drive/11GunvCqJuebfeTlgbJWkIMT0xJH6PWF1?usp=sharing
  10. """
  11. import json
  12. import time
  13. import gzip
  14. import os
  15. base_directory = os.path.dirname(os.path.realpath(__file__))
  16. def predict(query: str):
  17. pass
  18. if __name__ == "__main__":
  19. predict("What is the capital of Germany?")