Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aichecker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Eggers
aichecker
Commits
ac1c1efa
Commit
ac1c1efa
authored
3 months ago
by
Jan Eggers
Browse files
Options
Downloads
Patches
Plain Diff
gpt4_description gefixt
parent
5bb4c0f1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
src/aichecker/check_tg.py
+6
-3
6 additions, 3 deletions
src/aichecker/check_tg.py
src/aichecker/check_wrappers.py
+16
-1
16 additions, 1 deletion
src/aichecker/check_wrappers.py
with
23 additions
and
5 deletions
pyproject.toml
+
1
−
1
View file @
ac1c1efa
...
...
@@ -10,7 +10,7 @@ authors = [
maintainers
=
[
{name
=
"Jan Eggers"
,
email
=
"jan.eggers@hr.de"
}
,
]
version
=
"0.2.3.
4
"
# Neue Versionsnummern für pip-Update
version
=
"0.2.3.
5
"
# Neue Versionsnummern für pip-Update
description
=
"Bluesky- und Telegram-Konten auf KI-Inhalte checken"
requires-python
=
">
=
3.8
"
dependencies
=
[
...
...
This diff is collapsed.
Click to expand it.
src/aichecker/check_tg.py
+
6
−
3
View file @
ac1c1efa
...
...
@@ -193,7 +193,8 @@ def tg_post_parse(b, save = True, describe = True):
}
if
describe
:
# GPT4o-mini versteht JPG, PNG, nicht animiertes GIF... und WEBP.
sticker
[
'
description
'
]
=
gpt4_description
(
sticker_url
)
image
=
base64
.
b64encode
(
requests
.
get
(
sticker_url
).
content
).
decode
(
'
utf-8
'
)
photo
[
'
description
'
]
=
gpt4_description
(
f
"
data:image/jpeg;base64,
{
image
}
"
)
if
save
:
sticker
[
'
file
'
]
=
save_url
(
sticker_url
,
f
"
{
channel
}
_
{
b_nr
}
_sticker
"
)
else
:
...
...
@@ -205,7 +206,8 @@ def tg_post_parse(b, save = True, describe = True):
# 'image': base64.b64encode(requests.get(photo_url).content).decode('utf-8')
}
if
describe
:
photo
[
'
description
'
]
=
gpt4_description
(
f
"
data:image/jpeg;base64,
{
photo
[
'
image
'
]
}
"
)
image
=
base64
.
b64encode
(
requests
.
get
(
photo_url
).
content
).
decode
(
'
utf-8
'
)
photo
[
'
description
'
]
=
gpt4_description
(
f
"
data:image/jpeg;base64,
{
image
}
"
)
if
save
:
photo
[
'
file
'
]
=
save_url
(
photo_url
,
f
"
{
channel
}
_
{
b_nr
}
_photo
"
)
else
:
...
...
@@ -254,7 +256,8 @@ def tg_post_parse(b, save = True, describe = True):
if
describe
:
video
[
'
transcription
'
]
=
transcribe
(
video
[
'
file
'
])
if
photo
is
not
None
:
photo
[
'
description
'
]
=
gpt4_description
(
f
"
data:image/jpeg;base64,
{
photo
[
'
image
'
]
}
"
)
image
=
base64
.
b64encode
(
requests
.
get
(
video_thumbnail_url
).
content
).
decode
(
'
utf-8
'
)
photo
[
'
description
'
]
=
gpt4_description
(
f
"
data:image/jpeg;base64,
{
image
}
"
)
else
:
video
=
None
# Document / Audio URL? https://t.me/telegram/35
...
...
This diff is collapsed.
Click to expand it.
src/aichecker/check_wrappers.py
+
16
−
1
View file @
ac1c1efa
...
...
@@ -13,6 +13,21 @@ from aiornot import Client
d_thresh
=
.
8
# 80 Prozent
limit
=
25
# Posts für den Check
def
object_to_dict
(
obj
):
"""
Recursively converts an object to a dictionary.
"""
if
isinstance
(
obj
,
dict
):
# Recursively handle dictionaries
return
{
k
:
object_to_dict
(
v
)
for
k
,
v
in
obj
.
items
()}
elif
hasattr
(
obj
,
"
__dict__
"
):
# Handle objects with __dict__
return
{
k
:
object_to_dict
(
v
)
for
k
,
v
in
vars
(
obj
).
items
()}
elif
isinstance
(
obj
,
(
list
,
tuple
,
set
)):
# Handle iterables
return
type
(
obj
)(
object_to_dict
(
v
)
for
v
in
obj
)
else
:
# Return the object if it cannot be converted
return
obj
def
detectora_wrapper
(
text
:
str
):
# Verpackung. Fügt nur den "Fortschrittsbalken" hinzu.
print
(
"
?
"
,
end
=
""
)
...
...
@@ -57,7 +72,7 @@ def aiornot_wrapper(content, is_image = True):
# Unterscheidung: Bilder haben den Confidence score im Unter-Key 'ai'
# Audios SOLLTEN eien Confidence-Wert in response.report.confidence haben, haben es aber nicht
'
confidence
'
:
response
.
report
.
ai
.
confidence
if
hasattr
(
response
.
report
,
'
ai
'
)
else
.
99
,
'
generator
'
:
response
.
report
.
generator
if
hasattr
(
response
.
report
,
'
generator
'
)
else
None
,
'
generator
'
:
object_to_dict
(
response
.
report
.
generator
)
if
hasattr
(
response
.
report
,
'
generator
'
)
else
None
,
})
print
(
f
"
\b
{
'
X
'
if
aiornot_dict
[
'
score
'
]
!
=
'
human
'
else
'
.
'
}
"
,
end
=
""
)
return
aiornot_dict
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment