зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-30 21:46:04 +02:00
fix: update function call in notebook to conform with renaming
Этот коммит содержится в:
родитель
8487947f5d
Коммит
1f2642f1b4
@ -142,7 +142,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"os.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"] = (\n",
|
"os.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"] = (\n",
|
||||||
" \"/home/inga/projects/misinformation-project/misinformation-notes/misinformation-campaign-981aa55a3b13.json\"\n",
|
" \"../../data/misinformation-campaign-981aa55a3b13.json\"\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -358,6 +358,11 @@
|
|||||||
"For the computationally demanding `SummaryDetector`, it is best to initialize the model first and then analyze each image while passing the model explicitly. This can be done in a separate loop or in the same loop as for text and emotion detection."
|
"For the computationally demanding `SummaryDetector`, it is best to initialize the model first and then analyze each image while passing the model explicitly. This can be done in a separate loop or in the same loop as for text and emotion detection."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
@ -370,7 +375,7 @@
|
|||||||
" subdict=image_dict, summary_model=model\n",
|
" subdict=image_dict, summary_model=model\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"image_summary_detector.analyse_images(analysis_type=\"summary\")"
|
"image_summary_detector.analyse_images_from_dict(analysis_type=\"summary\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -387,9 +392,9 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# initialize the models\n",
|
"# initialize the models\n",
|
||||||
"# currently this does not work because of the way the summary detector is implemented\n",
|
"model = ammico.MultimodalSummaryModel()\n",
|
||||||
"image_summary_detector = ammico.SummaryDetector(\n",
|
"image_summary_detector = ammico.ImageSummaryDetector(\n",
|
||||||
" subdict=image_dict, analysis_type=\"summary\", model_type=\"base\"\n",
|
" subdict=image_dict, summary_model=model\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"for num, key in tqdm(\n",
|
"for num, key in tqdm(\n",
|
||||||
@ -399,9 +404,9 @@
|
|||||||
" image_dict[key]\n",
|
" image_dict[key]\n",
|
||||||
" ).analyse_image() # analyse image with EmotionDetector and update dict\n",
|
" ).analyse_image() # analyse image with EmotionDetector and update dict\n",
|
||||||
" image_dict[key] = ammico.TextDetector(\n",
|
" image_dict[key] = ammico.TextDetector(\n",
|
||||||
" image_dict[key], analyse_text=True\n",
|
" image_dict[key]\n",
|
||||||
" ).analyse_image() # analyse image with TextDetector and update dict\n",
|
" ).analyse_image() # analyse image with TextDetector and update dict\n",
|
||||||
" image_dict[key] = image_summary_detector.analyse_image(\n",
|
" image_dict[key] = image_summary_detector.analyse_images_from_dict(\n",
|
||||||
" subdict=image_dict[key], analysis_type=\"summary\"\n",
|
" subdict=image_dict[key], analysis_type=\"summary\"\n",
|
||||||
" ) # analyse image with SummaryDetector and update dict\n",
|
" ) # analyse image with SummaryDetector and update dict\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -1553,7 +1558,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.11.13"
|
"version": "3.11.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
Загрузка…
x
Ссылка в новой задаче
Block a user