ghengx commited on
Commit ·
70e05ba
1
Parent(s): 4362c52
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,38 +1,19 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
import warnings
|
|
|
|
| 4 |
|
| 5 |
warnings.filterwarnings("ignore")
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
# Try to pull dataset if specified
|
| 17 |
-
if 'DATASET' in os.environ and os.environ['DATASET'].strip():
|
| 18 |
-
try:
|
| 19 |
-
repo = Repository(
|
| 20 |
-
local_dir="",
|
| 21 |
-
repo_type="dataset",
|
| 22 |
-
clone_from=os.environ['DATASET'],
|
| 23 |
-
token=True
|
| 24 |
-
)
|
| 25 |
-
repo.git_pull()
|
| 26 |
-
print("✅ Dataset pulled successfully")
|
| 27 |
-
except Exception as e:
|
| 28 |
-
print(f"⚠️ Warning: Could not pull dataset: {e}")
|
| 29 |
-
else:
|
| 30 |
-
print("ℹ️ No HF_TOKEN found, skipping Hugging Face authentication")
|
| 31 |
-
|
| 32 |
-
except ImportError as e:
|
| 33 |
-
print(f"⚠️ Warning: Could not import Hugging Face Hub: {e}")
|
| 34 |
-
except Exception as e:
|
| 35 |
-
print(f"⚠️ Warning: Hugging Face authentication failed: {e}")
|
| 36 |
|
| 37 |
# Import the AI detector
|
| 38 |
from model import AIContentDetector
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
import warnings
|
| 4 |
+
from huggingface_hub import Repository, login
|
| 5 |
|
| 6 |
warnings.filterwarnings("ignore")
|
| 7 |
|
| 8 |
+
login(token=os.environ['HF_TOKEN'])
|
| 9 |
+
|
| 10 |
+
repo = Repository(
|
| 11 |
+
local_dir="",
|
| 12 |
+
repo_type="dataset",
|
| 13 |
+
clone_from=os.environ['DATASET'],
|
| 14 |
+
token=True
|
| 15 |
+
)
|
| 16 |
+
repo.git_pull()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Import the AI detector
|
| 19 |
from model import AIContentDetector
|