MogensR commited on
Commit
5abdee8
·
1 Parent(s): 8803453

Create __init__.py

Browse files
Files changed (1) hide show
  1. api/__init__.py +135 -0
api/__init__.py ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ BackgroundFX Pro API Module.
3
+ Provides high-level interfaces for processing, streaming, and serving.
4
+ """
5
+
6
+ from .pipeline import (
7
+ ProcessingPipeline,
8
+ PipelineConfig,
9
+ PipelineResult,
10
+ ProcessingMode,
11
+ PipelineStage
12
+ )
13
+
14
+ from .video_processor import (
15
+ VideoProcessorAPI,
16
+ VideoStats,
17
+ StreamConfig,
18
+ VideoStreamMode,
19
+ OutputFormat
20
+ )
21
+
22
+ from .batch_processor import (
23
+ BatchProcessor,
24
+ BatchConfig,
25
+ BatchItem,
26
+ BatchReport,
27
+ BatchPriority,
28
+ FileType
29
+ )
30
+
31
+ from .api_server import (
32
+ app,
33
+ ServerConfig,
34
+ ProcessingRequest,
35
+ ImageProcessingRequest,
36
+ VideoProcessingRequest,
37
+ BatchProcessingRequest,
38
+ StreamingRequest,
39
+ ProcessingResponse,
40
+ JobStatus,
41
+ JobManager
42
+ )
43
+
44
+ from .websocket import (
45
+ WebSocketHandler,
46
+ WebSocketServer,
47
+ WSMessage,
48
+ MessageType,
49
+ ClientSession,
50
+ SessionManager,
51
+ FrameProcessor,
52
+ start_standalone_server
53
+ )
54
+
55
+ __all__ = [
56
+ # Pipeline
57
+ 'ProcessingPipeline',
58
+ 'PipelineConfig',
59
+ 'PipelineResult',
60
+ 'ProcessingMode',
61
+ 'PipelineStage',
62
+
63
+ # Video Processor
64
+ 'VideoProcessorAPI',
65
+ 'VideoStats',
66
+ 'StreamConfig',
67
+ 'VideoStreamMode',
68
+ 'OutputFormat',
69
+
70
+ # Batch Processor
71
+ 'BatchProcessor',
72
+ 'BatchConfig',
73
+ 'BatchItem',
74
+ 'BatchReport',
75
+ 'BatchPriority',
76
+ 'FileType',
77
+
78
+ # API Server
79
+ 'app',
80
+ 'ServerConfig',
81
+ 'ProcessingRequest',
82
+ 'ImageProcessingRequest',
83
+ 'VideoProcessingRequest',
84
+ 'BatchProcessingRequest',
85
+ 'StreamingRequest',
86
+ 'ProcessingResponse',
87
+ 'JobStatus',
88
+ 'JobManager',
89
+
90
+ # WebSocket
91
+ 'WebSocketHandler',
92
+ 'WebSocketServer',
93
+ 'WSMessage',
94
+ 'MessageType',
95
+ 'ClientSession',
96
+ 'SessionManager',
97
+ 'FrameProcessor',
98
+ 'start_standalone_server'
99
+ ]
100
+
101
+ # Version info
102
+ __version__ = '1.0.0'
103
+
104
+ # Quick start functions
105
+ def start_api_server(host: str = "0.0.0.0", port: int = 8000, **kwargs):
106
+ """Quick start the REST API server."""
107
+ import uvicorn
108
+ from .api_server import app, config
109
+
110
+ config.HOST = host
111
+ config.PORT = port
112
+
113
+ for key, value in kwargs.items():
114
+ if hasattr(config, key.upper()):
115
+ setattr(config, key.upper(), value)
116
+
117
+ uvicorn.run(app, host=host, port=port)
118
+
119
+
120
+ def start_websocket_server(host: str = "0.0.0.0", port: int = 8001):
121
+ """Quick start the WebSocket server."""
122
+ import asyncio
123
+ asyncio.run(start_standalone_server(host, port))
124
+
125
+
126
+ def create_pipeline(**kwargs) -> ProcessingPipeline:
127
+ """Create a configured processing pipeline."""
128
+ config = PipelineConfig(**kwargs)
129
+ return ProcessingPipeline(config)
130
+
131
+
132
+ def create_batch_processor(**kwargs) -> BatchProcessor:
133
+ """Create a configured batch processor."""
134
+ config = BatchConfig(**kwargs)
135
+ return BatchProcessor(config)