Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,28 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import os
|
| 3 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
import requests
|
|
|
|
| 5 |
from langdetect import detect
|
| 6 |
-
import gradio as gr
|
| 7 |
|
| 8 |
# -----------------------------------------------------------------------------
|
| 9 |
# Configuration
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Gradio Space for Human-AI Text Attribution (HATA) Model
|
| 3 |
+
Detects whether text is human-written or AI-generated
|
| 4 |
+
Supports multiple African languages
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
# --- Hard-disable Gradio's audio stack under Python 3.13 ---
|
| 8 |
import os
|
| 9 |
+
import sys
|
| 10 |
+
import types
|
| 11 |
+
|
| 12 |
+
# Disable PyDub so Gradio won't attempt audio features
|
| 13 |
+
os.environ["GRADIO_DISABLE_PYDUB"] = "1"
|
| 14 |
+
|
| 15 |
+
# Provide stubs for missing modules
|
| 16 |
+
if "audioop" not in sys.modules:
|
| 17 |
+
sys.modules["audioop"] = types.ModuleType("audioop")
|
| 18 |
+
if "pyaudioop" not in sys.modules:
|
| 19 |
+
sys.modules["pyaudioop"] = types.ModuleType("pyaudioop")
|
| 20 |
+
|
| 21 |
+
# Safe to import Gradio and other dependencies now
|
| 22 |
+
import gradio as gr
|
| 23 |
import requests
|
| 24 |
+
import math
|
| 25 |
from langdetect import detect
|
|
|
|
| 26 |
|
| 27 |
# -----------------------------------------------------------------------------
|
| 28 |
# Configuration
|