Spaces:
Running on Zero
Running on Zero
Add pkg_resources compatibility shim for Python 3.12
Browse files- .gitattributes +0 -1
- app.py +11 -1
- requirements.txt +2 -1
.gitattributes
CHANGED
|
@@ -33,4 +33,3 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
-
UniversalFakeDetect/resources/teaser.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
app.py
CHANGED
|
@@ -6,6 +6,16 @@ from PIL import Image
|
|
| 6 |
import torch
|
| 7 |
import gradio as gr
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Ensure UniversalFakeDetect is in Python path
|
| 10 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 11 |
UFD_DIR = os.path.join(BASE_DIR, "UniversalFakeDetect")
|
|
@@ -291,7 +301,7 @@ with gr.Blocks(title="UniversalFakeDetect - Single Image Analysis", css=custom_c
|
|
| 291 |
|
| 292 |
with gr.Accordion("ℹ️ Model Architecture & Citation Details", open=False):
|
| 293 |
gr.Markdown(
|
| 294 |
-
"""
|
| 295 |
- **Model**: `UniversalFakeDetect` (CLIP:ViT-L/14 Backbone + Linear Classifier)
|
| 296 |
- **Paper**: *Towards Universal Fake Image Detectors that Generalize Across Generative Models* (CVPR 2023)
|
| 297 |
- **Authors**: Utkarsh Ojha*, Yuheng Li*, Yong Jae Lee (Wisconsin AI and Vision Lab)
|
|
|
|
| 6 |
import torch
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
+
# Compatibility shim for Python 3.12+ environments where pkg_resources is deprecated/absent
|
| 10 |
+
try:
|
| 11 |
+
import pkg_resources
|
| 12 |
+
except ImportError:
|
| 13 |
+
import packaging
|
| 14 |
+
import types
|
| 15 |
+
_pr = types.ModuleType("pkg_resources")
|
| 16 |
+
_pr.packaging = packaging
|
| 17 |
+
sys.modules["pkg_resources"] = _pr
|
| 18 |
+
|
| 19 |
# Ensure UniversalFakeDetect is in Python path
|
| 20 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 21 |
UFD_DIR = os.path.join(BASE_DIR, "UniversalFakeDetect")
|
|
|
|
| 301 |
|
| 302 |
with gr.Accordion("ℹ️ Model Architecture & Citation Details", open=False):
|
| 303 |
gr.Markdown(
|
| 304 |
+
r"""
|
| 305 |
- **Model**: `UniversalFakeDetect` (CLIP:ViT-L/14 Backbone + Linear Classifier)
|
| 306 |
- **Paper**: *Towards Universal Fake Image Detectors that Generalize Across Generative Models* (CVPR 2023)
|
| 307 |
- **Authors**: Utkarsh Ojha*, Yuheng Li*, Yong Jae Lee (Wisconsin AI and Vision Lab)
|
requirements.txt
CHANGED
|
@@ -5,5 +5,6 @@ numpy
|
|
| 5 |
tqdm
|
| 6 |
ftfy
|
| 7 |
regex
|
| 8 |
-
|
|
|
|
| 9 |
psutil
|
|
|
|
| 5 |
tqdm
|
| 6 |
ftfy
|
| 7 |
regex
|
| 8 |
+
packaging
|
| 9 |
+
setuptools<70
|
| 10 |
psutil
|