Skip to content

Commit

Permalink
Documentation update (#160)
Browse files Browse the repository at this point in the history
* Changed README.md

* Changed docs notebooks

---------

Co-authored-by: Inga Ulusoy <inga.ulusoy@uni-heidelberg.de>
  • Loading branch information
piterand and iulusoy authored Oct 30, 2023
1 parent 8287f35 commit fe1e937
Show file tree
Hide file tree
Showing 20 changed files with 692 additions and 1,146 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ The `AMMICO` package can be installed using pip:
```
pip install ammico
```
This will install the package and its dependencies locally.
This will install the package and its dependencies locally. If after installation you get some errors when running some modules, please follow the instructions below.

Some ammico components require tensorflow (e.g. Emotion detector), some pytorch (e.g. Summary detector). Sometimes there are compatibility problems between these two frameworks. To avoid compatibility problems on your machines, we suggest you to follow these steps before installing the package (you need conda on your machine):
## Compatibility problems solving

Some ammico components require `tensorflow` (e.g. Emotion detector), some `pytorch` (e.g. Summary detector). Sometimes there are compatibility problems between these two frameworks. To avoid these problems on your machines, you can prepare proper environment before installing the package (you need conda on your machine):

### 1. First, install tensorflow (https://www.tensorflow.org/install/pip)
- create a new environment with python and activate it
Expand Down Expand Up @@ -68,7 +70,7 @@ Some ammico components require tensorflow (e.g. Emotion detector), some pytorch
```conda activate ammico_env ```
- and now we can install tensorflow
- install tensorflow
```python -m pip install tensorflow==2.12.1```
Expand All @@ -85,7 +87,7 @@ Some ammico components require tensorflow (e.g. Emotion detector), some pytorch
It is done.
### Micromamba
If you have micromamba on your machine you can prepare environment with just one command:
If you are using micromamba you can prepare environment with just one command:
```micromamba create --no-channel-priority -c nvidia -c pytorch -c conda-forge -n ammico_env "python=3.10" pytorch torchvision torchaudio pytorch-cuda "tensorflow-gpu<=2.12.3" "numpy<=1.23.4"```
Expand Down
225 changes: 203 additions & 22 deletions ammico/notebooks/DemoNotebook_ammico.ipynb

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions ammico/notebooks/colors_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@
"metadata": {},
"outputs": [],
"source": [
"outdict = ammico.append_data_to_dict(mydict)\n",
"df = ammico.dump_df(outdict)"
"df = ammico.get_dataframe(mydict)"
]
},
{
Expand Down
11 changes: 1 addition & 10 deletions ammico/notebooks/facial_expressions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@
"metadata": {},
"outputs": [],
"source": [
"outdict = ammico.append_data_to_dict(mydict)\n",
"df = ammico.dump_df(outdict)"
"df = ammico.get_dataframe(mydict)"
]
},
{
Expand Down Expand Up @@ -177,14 +176,6 @@
"source": [
"df.to_csv(\"/content/drive/MyDrive/misinformation-data/data_out.csv\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b1a80023",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
11 changes: 1 addition & 10 deletions ammico/notebooks/get-text-from-image.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@
"metadata": {},
"outputs": [],
"source": [
"outdict = ammico.append_data_to_dict(mydict)\n",
"df = ammico.dump_df(outdict)"
"df = ammico.get_dataframe(mydict)"
]
},
{
Expand Down Expand Up @@ -339,14 +338,6 @@
"source": [
"topic_model.save(\"misinfo_posts\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7c94edb9",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
20 changes: 4 additions & 16 deletions ammico/notebooks/image_summary.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"outputs": [],
"source": [
"for key in mydict:\n",
" mydict[key] = obj.analyse_image(analysis_type=\"summary\", subdict = mydict[key])"
" mydict[key] = obj.analyse_image(subdict = mydict[key], analysis_type=\"summary\")"
]
},
{
Expand Down Expand Up @@ -148,8 +148,7 @@
},
"outputs": [],
"source": [
"outdict = ammico.append_data_to_dict(mydict)\n",
"df = ammico.dump_df(outdict)"
"df = ammico.get_dataframe(mydict)"
]
},
{
Expand Down Expand Up @@ -287,8 +286,7 @@
"metadata": {},
"outputs": [],
"source": [
"outdict2 = ammico.append_data_to_dict(mydict)\n",
"df2 = ammico.dump_df(outdict2)"
"df2 = ammico.get_dataframe(mydict)"
]
},
{
Expand Down Expand Up @@ -510,17 +508,7 @@
"metadata": {},
"outputs": [],
"source": [
"outdict = ammico.append_data_to_dict(mydict)\n",
"df = ammico.dump_df(outdict)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"mydict"
"df = ammico.get_dataframe(mydict)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion ammico/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ def load_vqa_model(self):

def analyse_image(
self,
analysis_type: Optional[str] = None,
subdict: dict = None,
analysis_type: Optional[str] = None,
list_of_questions: Optional[list[str]] = None,
consequential_questions: bool = False,
):
Expand Down
Binary file added docs/source/_static/emotion_detector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/summary_detector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/text_detector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 1 addition & 17 deletions docs/source/ammico.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,7 @@ faces module
color_analysis module
---------------------

.. automodule:: color_analysis
:members:
:undoc-members:
:show-inheritance:

objects module
--------------

.. automodule:: objects
:members:
:undoc-members:
:show-inheritance:

objects_cvlib module
--------------------

.. automodule:: objects_cvlib
.. automodule:: colors
:members:
:undoc-members:
:show-inheritance:
Expand Down
8 changes: 8 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
nbsphinx_allow_errors = True
napoleon_custom_sections = [("Returns", "params_style")]

html_context = {
"display_github": True, # Integrate GitHub
"github_user": "ssciwr", # Username
"github_repo": "AMMICO", # Repo name
"github_version": "main", # Version
"conf_py_path": "/source/", # Path in the checkout to the docs root
}

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

Expand Down
5 changes: 1 addition & 4 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ Welcome to AMMICO's documentation!
:caption: Contents:

readme_link
notebooks/Example faces
notebooks/Example text
notebooks/Example summary
notebooks/DemoNotebook_ammico
notebooks/Example multimodal
notebooks/Example colors
notebooks/Example objects
notebooks/Example cropposts
modules
license_link
Expand Down
Loading

0 comments on commit fe1e937

Please sign in to comment.