Fixes and new ai model

This commit is contained in:
Ryan Shpeherd
2026-09-25 22:40:24 -04:00
parent 8f2834775b
commit 589b775cda
2 changed files with 23 additions and 11 deletions
+8 -6
View File
@@ -6,13 +6,15 @@ use JSON;
use Data::Dumper;
my $seconds = $ENV{'SECONDS_PER_FRAME'} || 30;
my $ollama = $ENV{'OLLAMA_URL'} || die "OLLAMA_URL environment variable not set\n";
my $api = $ENV{'API_BASE_URL'} || die "API_BASE_URL environment variable not set\n";
my $ollama = $ENV{'OLLAMA_URL'} || 'http://10.0.1.7:11434';
my $api = $ENV{'API_BASE_URL'} || 'http://10.0.1.7:3000';
my $task_count = $ENV{'TASK_COUNT'} || 1;
my $sensitivity = 20;
my $resolution = "672:672";
my $model = "hf.co/Jommarn/UNSEEN_Gemma_4_26B_NSFW-GGUF:Q8_0";
chdir("/tmp") || die "Unable to change directory to /tmp: $!\n";
my $ua = LWP::UserAgent->new;
$ua->timeout(60);
@@ -56,16 +58,16 @@ sub CheckPath {
$data=undef;
my $ref = {
'model' => 'srizon/pixie:latest',
'prompt' => "Are there any african american people in this photo, whether they are shown completely or not? Please answer 'yes' or 'no' only.",
'model' => $model,
'prompt' => "Are there any african american men in this photo, whether they are shown completely or not? Judge based on skin tone, accounting for shadows. Answer yes for very dark skin.Please answer 'yes' or 'no' only.",
'images' => [$base64],
};
my $url = "$ollama/api/generate";
my $res = GetRest($url, $ref);
print "\t$res\n";
print "$file\t$res\n";
$total++;
if($res=~/yes/i) {
if($res=~/yes$/i) {
$yes++;
}
unlink($file);
+15 -5
View File
@@ -214,6 +214,10 @@ def index():
@app.route("/review/<int:task_id>")
def review_task(task_id):
"""Detail view: show task info + embedded video player."""
return_page = request.args.get("page", 1, type=int) or 1
return_page = max(return_page, 1)
return_queue_url = "/" if return_page == 1 else f"/?page={return_page}"
try:
data = api_get(f"task/{task_id}")
if not data or not data.get("id"):
@@ -240,7 +244,11 @@ def review_task(task_id):
except (json.JSONDecodeError, TypeError):
video_obj["prev_results"] = {}
return render_template_string(_REVIEW_TEMPLATE, video=video_obj)
return render_template_string(
_REVIEW_TEMPLATE,
video=video_obj,
return_queue_url=return_queue_url,
)
# ---------------------------------------------------------------------------
@@ -411,7 +419,7 @@ _INDEX_TEMPLATE = """
<td><span class="badge">{{ t.task_type }}</span></td>
<td>{{ t.status }}</td>
<td>{{ t.created_at|string|truncate(19, True, '') if t.created_at else '&mdash;' }}</td>
<td><a href="/review/{{ t.id }}" class="btn">Review</a></td>
<td><a href="{{ url_for('review_task', task_id=t.id, page=page) }}" class="btn">Review</a></td>
</tr>
{% endfor %}
</tbody>
@@ -464,7 +472,7 @@ _REVIEW_TEMPLATE = """
<div id="flash"></div>
<div class="header">
<h1>VideoDetect</h1>
<a href="/">&laquo; Back to queue</a>
<a href="{{ return_queue_url }}">&laquo; Back to queue</a>
</div>
<div class="container">
{% if video.prev_results and video.prev_results.review_verdict %}
@@ -505,6 +513,8 @@ _REVIEW_TEMPLATE = """
</div>
<script>
const returnQueueUrl = {{ return_queue_url|tojson }};
async function submitVerdict(verdict) {
setActionButtonsDisabled(true);
showFlash('Submitting verdict...', '#007bff');
@@ -518,7 +528,7 @@ async function submitVerdict(verdict) {
const body = await resp.json().catch(() => ({}));
if (resp.ok) {
showFlash('Verdict submitted', '#28a745');
setTimeout(() => location.href = '/', 1000);
setTimeout(() => location.href = returnQueueUrl, 1000);
} else {
alert(body.error || 'Submission failed');
setActionButtonsDisabled(false);
@@ -538,7 +548,7 @@ async function skipTask() {
const resp = await fetch(`/api/review/skip/{{ video.id }}`, {method: 'POST'});
if (resp.ok) {
showFlash('Task skipped, returned to queue', '#6c757d');
setTimeout(() => location.href = '/', 1000);
setTimeout(() => location.href = returnQueueUrl, 1000);
} else {
alert('Skip failed');
setActionButtonsDisabled(false);