Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- MANIFEST.in +9 -0
- spaces_config.yml +29 -0
- test_app.py +47 -0
MANIFEST.in
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
include README.md
|
| 2 |
+
include requirements.txt
|
| 3 |
+
include Dockerfile
|
| 4 |
+
include .gitignore
|
| 5 |
+
include spaces_config.yml
|
| 6 |
+
recursive-include static *
|
| 7 |
+
recursive-include templates *
|
| 8 |
+
recursive-exclude * __pycache__
|
| 9 |
+
recursive-exclude * *.py[co]
|
spaces_config.yml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hugging Face Spaces Configuration
|
| 2 |
+
title: "Lecture Capture AI Pipeline"
|
| 3 |
+
emoji: "🎓"
|
| 4 |
+
colorFrom: "blue"
|
| 5 |
+
colorTo: "purple"
|
| 6 |
+
sdk: "gradio"
|
| 7 |
+
sdk_version: "4.44.0"
|
| 8 |
+
app_file: "app.py"
|
| 9 |
+
pinned: false
|
| 10 |
+
license: "mit"
|
| 11 |
+
python_version: "3.10"
|
| 12 |
+
|
| 13 |
+
# Hardware requirements
|
| 14 |
+
hardware: "cpu-basic" # or "cpu-upgrade" for better performance
|
| 15 |
+
|
| 16 |
+
# Environment variables (if needed)
|
| 17 |
+
# env:
|
| 18 |
+
# - name: "CUSTOM_VAR"
|
| 19 |
+
# value: "custom_value"
|
| 20 |
+
|
| 21 |
+
# Secrets (configure in HF Spaces settings)
|
| 22 |
+
# secrets:
|
| 23 |
+
# - "HF_TOKEN"
|
| 24 |
+
|
| 25 |
+
# Disable automatic model downloads in Spaces
|
| 26 |
+
disable_embedding: false
|
| 27 |
+
|
| 28 |
+
# Custom startup command (optional)
|
| 29 |
+
# startup_duration_timeout: 300
|
test_app.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pytest
|
| 2 |
+
import tempfile
|
| 3 |
+
import os
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from app import (
|
| 6 |
+
format_timestamp,
|
| 7 |
+
extract_key_phrases,
|
| 8 |
+
setup_spacy,
|
| 9 |
+
check_ffmpeg
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
def test_format_timestamp():
|
| 13 |
+
"""Test timestamp formatting function"""
|
| 14 |
+
assert format_timestamp(0) == "00:00"
|
| 15 |
+
assert format_timestamp(60) == "01:00"
|
| 16 |
+
assert format_timestamp(125) == "02:05"
|
| 17 |
+
assert format_timestamp(3661) == "61:01"
|
| 18 |
+
|
| 19 |
+
def test_extract_key_phrases():
|
| 20 |
+
"""Test key phrase extraction"""
|
| 21 |
+
text = "Machine learning is a powerful tool for data analysis and artificial intelligence applications."
|
| 22 |
+
phrases = extract_key_phrases(text, top_n=3)
|
| 23 |
+
assert isinstance(phrases, list)
|
| 24 |
+
assert len(phrases) <= 3
|
| 25 |
+
|
| 26 |
+
def test_setup_spacy():
|
| 27 |
+
"""Test spaCy setup"""
|
| 28 |
+
nlp = setup_spacy()
|
| 29 |
+
# Should either return a spaCy model or None
|
| 30 |
+
assert nlp is None or hasattr(nlp, '__call__')
|
| 31 |
+
|
| 32 |
+
def test_check_ffmpeg():
|
| 33 |
+
"""Test FFmpeg availability check"""
|
| 34 |
+
result = check_ffmpeg()
|
| 35 |
+
assert isinstance(result, bool)
|
| 36 |
+
|
| 37 |
+
def test_app_imports():
|
| 38 |
+
"""Test that the app can be imported without errors"""
|
| 39 |
+
try:
|
| 40 |
+
import app
|
| 41 |
+
assert hasattr(app, 'run_pipeline')
|
| 42 |
+
assert hasattr(app, 'create_interface')
|
| 43 |
+
except ImportError as e:
|
| 44 |
+
pytest.fail(f"Failed to import app: {e}")
|
| 45 |
+
|
| 46 |
+
if __name__ == "__main__":
|
| 47 |
+
pytest.main([__file__])
|