This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Flask application for converting images to 3D using Apple's SHARP model. | |
| Installation: | |
| 1. Clone ml-sharp repository: | |
| git clone https://github.com/apple/ml-sharp | |
| cd ml-sharp | |
| pip install -r requirements.txt | |
| 2. Install Flask and Flask-CORS: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Flask application for converting images to 3D using Apple's SHARP model. | |
| Installation: | |
| 1. Clone ml-sharp repository: | |
| git clone https://github.com/apple/ml-sharp | |
| cd ml-sharp | |
| pip install -r requirements.txt | |
| 2. Install Flask and Flask-CORS: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <errno.h> | |
| #include <fcntl.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <arpa/inet.h> | |
| #include <netdb.h> | |
| #include <sys/resource.h> | |
| #include <sys/time.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (() => { | |
| // Detect environment | |
| const detectEnvironment = () => { | |
| const ua = navigator.userAgent; | |
| const isVSCode = ua.includes('Visual Studio Code') || | |
| typeof acquireVsCodeApi !== 'undefined' || | |
| window.vscodeApi !== undefined; | |
| const isElectron = ua.includes('Electron') || typeof require !== 'undefined'; | |
| const isChrome = /Chrome/.test(ua) && !/Edge/.test(ua); | |
| const isFirefox = /Firefox/.test(ua); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import os | |
| import pyaudio | |
| from cartesia import AsyncCartesia | |
| async def streaming_stt_example(): | |
| """ | |
| Advanced async STT example for real-time streaming applications. | |
| This example captures microphone input and processes it in real-time | |
| with proper error handling and demonstrates endpointing and word timestamp features. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This function estimates the corner radius of a window by checking multiple directions from each corner | |
| # and finding the distance where the image changes from transparent to solid. | |
| # It’s useful for detecting rounded corners in screenshots of macOS windows or pixel data of images etc. | |
| def estimate_corner_radius(self, image_or_array, threshold=128, samples=8): | |
| import math | |
| import numpy as np | |
| # if input is a PIL Image, convert to numpy array | |
| if hasattr(image_or_array, 'convert'): |