diff --git a/README.rst b/README.rst index f1b13ea21..262d1d183 100644 --- a/README.rst +++ b/README.rst @@ -12,11 +12,11 @@ Haystack is designed in a modular way and is tightly integrated with the `FARM < Swap your models easily from BERT to roBERTa and scale the database from dev (Sqlite) to production (PostgreSQL, elasticsearch ...). Core Features -========== +============= - **Most powerful models**: Utilize all the latest transformer based models (BERT, ALBERT roBERTa ...) -- **Modular & future-proof**: Avoid technical debt. With haystack you can easily switch to newer models once they get published. -- **Developer friendly**: Easy to debug, extend and modify -- **Scalable**: Switch from dev to production within minutes. +- **Modular & future-proof**: Avoid technical debt. With haystack you can easily switch to newer models once they get published. +- **Developer friendly**: Easy to debug, extend and modify. +- **Scalable**: Switch from dev to production within minutes. Components ========== @@ -37,9 +37,14 @@ Installation ------------ There are two ways to install: -* (recommended) from source, :code:`git clone ` and run :code:`pip install [--editable] .` from the root of the repositry. +* (recommended) from source, :code:`git clone ` and run :code:`pip install [--editable] .` from the root of the repositry. * from PyPI, do a :code:`pip install farm_haystack` +Usage +----- +.. image:: https://raw.githubusercontent.com/deepset-ai/haystack/master/docs/img/code_snippet_usage.png + + Configuration ------------- The configuration can be supplied in a :code:`qa_config.py` placed in the PYTHONPATH. Alternatively, the :code:`DATABASE_URL` can also be set an an environment variable. diff --git a/docs/img/code_snippet_usage.png b/docs/img/code_snippet_usage.png new file mode 100644 index 000000000..89a280c8f Binary files /dev/null and b/docs/img/code_snippet_usage.png differ diff --git a/example.py b/example.py new file mode 100644 index 000000000..e69de29bb diff --git a/farm_haystack/__init__.py b/farm_haystack/__init__.py index a51f248d7..98870bbf1 100644 --- a/farm_haystack/__init__.py +++ b/farm_haystack/__init__.py @@ -60,7 +60,7 @@ class Finder: retrieved_scores, question, candidate_doc_ids=candidate_doc_ids ) results = self.reader.predict(inference_dicts, top_k=top_k_reader) - return results + return results["results"] def _convert_retrieved_text_to_reader_format( self, retrieved_scores, question, candidate_doc_ids=None, verbose=True diff --git a/farm_haystack/utils.py b/farm_haystack/utils.py index 2610776a1..026754d3d 100644 --- a/farm_haystack/utils.py +++ b/farm_haystack/utils.py @@ -18,7 +18,8 @@ def create_db(): db.session.create_all() -def print_answers(answers, details="all"): +def print_answers(results, details="all"): + answers = results[0]["answers"] pp = pprint.PrettyPrinter(indent=4) if details != "all": if details == "minimal":