-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updating premain #849
updating premain #849
Conversation
Pygrabber + Mac fix
Moved Windows only modules, to top too.
change if from before statement to elif, also fix conditional ladder
This reverts commit ed7a216.
Added for optimization Co-Authored-By: Zephira <[email protected]>
Fix "Update face_enhancer.py"
Reviewer's Guide by SourceryThis pull request updates the UI and face enhancer modules to include platform-specific logic. In the UI module, Windows-specific imports are added, and camera detection is refactored to handle macOS and Linux separately. The face enhancer module is refactored to use match-case for platform-specific initialization, improving clarity and maintainability. Sequence diagram for platform-specific camera detectionsequenceDiagram
participant App
participant CameraDetector
participant OS
participant Camera
App->>CameraDetector: get_available_cameras()
alt macOS
CameraDetector->>OS: Check platform
OS-->>CameraDetector: Darwin
CameraDetector->>Camera: Try FaceTime camera (index 0)
Camera-->>CameraDetector: Camera status
loop Additional cameras
CameraDetector->>Camera: Try indices 1,2
Camera-->>CameraDetector: Camera status
end
else Linux/Other
CameraDetector->>OS: Check platform
OS-->>CameraDetector: Other
loop Test cameras
CameraDetector->>Camera: Try indices 0-9
Camera-->>CameraDetector: Camera status
end
end
CameraDetector-->>App: Return camera list
State diagram for face enhancer initializationstateDiagram-v2
[*] --> CheckPlatform
CheckPlatform --> Darwin: platform == Darwin
CheckPlatform --> OtherOS: platform != Darwin
Darwin --> CheckMPS: Check MPS availability
CheckMPS --> MPSAvailable: Yes
CheckMPS --> MPSNotAvailable: No
MPSAvailable --> InitWithMPS: Initialize with MPS device
MPSNotAvailable --> InitDefault: Initialize with default
OtherOS --> InitDefault: Initialize with default
InitWithMPS --> [*]
InitDefault --> [*]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @KRSHH - I've reviewed your changes - here's some feedback:
Overall Comments:
- The Windows-specific import (pygrabber.dshow_graph) is added but not used anywhere in the code. Consider removing it until it's needed to avoid unnecessary dependencies.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Enhance platform-specific handling for camera detection and face enhancer initialization.
Enhancements: