diff --git a/.coveragerc b/.coveragerc
index 3dbfbb4..c712d25 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -1,2 +1,2 @@
[run]
-omit = tests/*
\ No newline at end of file
+omit = tests/*
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 3a1a6eb..f7adaa5 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -3,10 +3,13 @@
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
+from __future__ import annotations
+
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import os
import sys
+
sys.path.insert(0, os.path.abspath("../../senju"))
project = 'senju'
diff --git a/docs/source/index.rst b/docs/source/index.rst
index aa7c231..d4ee233 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -16,4 +16,4 @@ documentation for details.
:caption: Contents:
usage
- _modules/modules
\ No newline at end of file
+ _modules/modules
diff --git a/senju/main.py b/senju/main.py
index 575dc73..a457e58 100644
--- a/senju/main.py
+++ b/senju/main.py
@@ -1,15 +1,14 @@
from __future__ import annotations
+import os
from pathlib import Path
-from flask import (Flask, redirect, render_template, request, url_for,
- send_from_directory)
+from flask import (Flask, redirect, render_template, request,
+ send_from_directory, url_for)
from senju.haiku import Haiku
from senju.store_manager import StoreManager
-import os
-
app = Flask(__name__)
store = StoreManager(Path("/tmp/store.db"))
@@ -121,7 +120,8 @@ def generate_haiku():
API endpoint to generate a new haiku based on the provided prompt.
Accepts POST requests with JSON data containing a 'prompt' field.
- Generates a haiku using the prompt, saves it to the store, and returns the ID.
+ Generates a haiku using the prompt, saves it to the store,
+ and returns the ID.
Returns:
str: The ID of the newly created haiku if method is POST.
diff --git a/senju/templates/scan.html b/senju/templates/scan.html
index b84a917..abe9564 100644
--- a/senju/templates/scan.html
+++ b/senju/templates/scan.html
@@ -12,7 +12,7 @@
-
+
Upload your image
@@ -27,7 +27,7 @@
-
+
@@ -39,17 +39,17 @@
-
+
Please upload an image first.
-
+
-
-
+
+
AI recognized the following:
Waiting for input...
@@ -62,7 +62,7 @@
-
+
Generating Haiku
@@ -103,24 +103,24 @@ Vote him, task complete.
const yesButton = document.getElementById('yes-button');
const noButton = document.getElementById('no-button');
const generatingHaikuBox = document.getElementById('generating-haiku-box');
- const generatedHaikuBox = document.getElementById('generated-haiku-box');
+ const generatedHaikuBox = document.getElementById('generated-haiku-box');
let imageUploaded = false;
function handleFileSelect(event) {
const file = event.target.files[0];
-
+
if (file && file.type.startsWith('image/')) {
// Create a URL for the selected image
const imageUrl = URL.createObjectURL(file);
-
+
// Set the image source
previewImg.src = imageUrl;
-
+
// Hide upload area and show image preview
uploadArea.classList.add('hidden');
imagePreview.classList.remove('hidden');
errorMessage.classList.add('hidden');
-
+
// Set flag that image is uploaded
imageUploaded = true;
}
@@ -128,14 +128,14 @@ Vote him, task complete.
function removeImage() {
dropzoneFile.value = '';
-
- // Hide image
+
+ // Hide image
imagePreview.classList.add('hidden');
uploadArea.classList.remove('hidden');
-
+
URL.revokeObjectURL(previewImg.src);
previewImg.src = '';
-
+
imageUploaded = false;
responseBox.classList.add('opacity-0');
generatingHaikuBox.classList.add('hidden');
@@ -148,32 +148,32 @@ Vote him, task complete.
if (imageUploaded) {
// Hide error
errorMessage.classList.add('hidden');
-
- // Show response box
+
+ // Show response box
responseBox.classList.remove('opacity-0');
-
- // Example response
+
+ // Example response
document.getElementById('ai-response').textContent = 'Dominic Monaghan interviewing Elijah Wood if he will wear wigs';
} else {
-
+
errorMessage.classList.remove('hidden');
-
+
uploadArea.classList.add('shake');
setTimeout(() => {
uploadArea.classList.remove('shake');
}, 600);
}
}
-
+
function handleYesClick() {
// Hide response box
responseBox.classList.add('opacity-0');
-
+
// Show generating haiku box first
setTimeout(() => {
responseBox.classList.add('hidden');
generatingHaikuBox.classList.remove('hidden');
-
+
// After a delay, hide generating box and show result
setTimeout(() => {
generatingHaikuBox.classList.add('hidden');
@@ -184,13 +184,13 @@ Vote him, task complete.
// Reset everything
removeImage();
}
-
+
dropzoneFile.addEventListener('change', handleFileSelect);
removeImageBtn.addEventListener('click', removeImage);
submitButton.addEventListener('click', handleSubmit);
yesButton.addEventListener('click', handleYesClick);
noButton.addEventListener('click', handleNoClick);
-
+
// Add some CSS animation
document.head.insertAdjacentHTML('beforeend', `