Spaces:
Paused
Paused
twindinx commited on
Commit ·
97b6401
1
Parent(s): d8ea019
fix preview_upload causing test fail
Browse files- .github/workflows/test.yml +2 -2
- app.py +1 -14
- images.py +12 -0
- test_app.py +1 -3
.github/workflows/test.yml
CHANGED
|
@@ -15,7 +15,7 @@ jobs:
|
|
| 15 |
uses: actions/checkout@v6
|
| 16 |
|
| 17 |
- name: Set up Python
|
| 18 |
-
uses: actions/setup-python@
|
| 19 |
with:
|
| 20 |
python-version: '3.14'
|
| 21 |
cache: 'pip'
|
|
@@ -32,7 +32,7 @@ jobs:
|
|
| 32 |
|
| 33 |
- name: Notify Discord on Success
|
| 34 |
if: success()
|
| 35 |
-
uses: tsickert/discord-webhook@
|
| 36 |
with:
|
| 37 |
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
|
| 38 |
content: "✅ Tests passed on `${{ github.ref_name }}` (${{ github.sha }})."
|
|
|
|
| 15 |
uses: actions/checkout@v6
|
| 16 |
|
| 17 |
- name: Set up Python
|
| 18 |
+
uses: actions/setup-python@v6
|
| 19 |
with:
|
| 20 |
python-version: '3.14'
|
| 21 |
cache: 'pip'
|
|
|
|
| 32 |
|
| 33 |
- name: Notify Discord on Success
|
| 34 |
if: success()
|
| 35 |
+
uses: tsickert/discord-webhook@v7.0.0
|
| 36 |
with:
|
| 37 |
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
|
| 38 |
content: "✅ Tests passed on `${{ github.ref_name }}` (${{ github.sha }})."
|
app.py
CHANGED
|
@@ -1,20 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from PIL import Image
|
| 3 |
-
|
| 4 |
from config import LOCAL_MODEL, REMOTE_MODEL, ASPECTS
|
| 5 |
from router import score_artwork # routing and failover
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
def preview_upload(file_path: str | None):
|
| 9 |
-
if not file_path:
|
| 10 |
-
return None, None, "Upload an image to begin."
|
| 11 |
-
|
| 12 |
-
try:
|
| 13 |
-
with Image.open(file_path) as image:
|
| 14 |
-
preview = image.convert("RGB")
|
| 15 |
-
return preview, file_path, "Image ready for critique."
|
| 16 |
-
except Exception as error:
|
| 17 |
-
return None, None, f"Could not read that image: {error}"
|
| 18 |
|
| 19 |
|
| 20 |
def login_status(profile: gr.OAuthProfile | None):
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
from config import LOCAL_MODEL, REMOTE_MODEL, ASPECTS
|
| 3 |
from router import score_artwork # routing and failover
|
| 4 |
+
from images import preview_upload
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
def login_status(profile: gr.OAuthProfile | None):
|
images.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from PIL import Image
|
| 2 |
+
|
| 3 |
+
def preview_upload(file_path: str | None):
|
| 4 |
+
if not file_path:
|
| 5 |
+
return None, None, "Upload an image to begin."
|
| 6 |
+
|
| 7 |
+
try:
|
| 8 |
+
with Image.open(file_path) as image:
|
| 9 |
+
preview = image.convert("RGB")
|
| 10 |
+
return preview, file_path, "Image ready for critique."
|
| 11 |
+
except Exception as error:
|
| 12 |
+
return None, None, f"Could not read that image: {error}"
|
test_app.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
| 1 |
import pytest
|
| 2 |
-
from PIL import Image
|
| 3 |
-
|
| 4 |
-
from app import preview_upload
|
| 5 |
from local_model import aestoken2score
|
| 6 |
from remote_model import parse_response
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def test_preview_upload_none():
|
|
|
|
| 1 |
import pytest
|
|
|
|
|
|
|
|
|
|
| 2 |
from local_model import aestoken2score
|
| 3 |
from remote_model import parse_response
|
| 4 |
+
from images import preview_upload
|
| 5 |
|
| 6 |
|
| 7 |
def test_preview_upload_none():
|