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
| def check_validity(my_url): | |
| try: | |
| urlopen(my_url) | |
| print("Valid URL") | |
| except IOError: | |
| print ("Invalid URL") | |
| sys.exit() |
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 * as ml5 from "ml5"; | |
| import p5Types from "p5"; |
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
| let capture: any = useRef<any>(); | |
| let classifier: any = useRef<any>(); | |
| //setting up the webcam from p5, and featureExtractor/classifier from ml5 | |
| const setup = (p5: p5Types, canvasParentRef: Element) => { | |
| capture.current = p5.createCapture(p5.VIDEO).parent(canvasParentRef); | |
| const featureExtractor = ml5.featureExtractor("MobileNet", {epochs: props.numberOfEpochs}, modelReady); | |
| classifier.current = featureExtractor.classification( | |
| capture.current, | |
| videoReady |
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
| function train() { | |
| classifier.current.train((lossValue: number ) => { | |
| console.log("Loss is", lossValue); | |
| if (lossValue) { | |
| setLossValue(lossValue) | |
| } | |
| if (lossValue == null) { | |
| setTrainingComplete(true); | |
| console.log("training complete"); | |
| } |
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
| function gotResult() { | |
| classifier.current.classify(capture.current, (err: any, result: any) => { | |
| console.log('result', result) | |
| setPrediction(result[0].label); | |
| setConfidence(result[0].confidence); | |
| }); | |
| } |
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
| export default function VideoComponent( | |
| props: VideoComponentProps | |
| ){ | |
| //console.log('NUMBER OF EPOCHS', props.numberOfEpochs) | |
| const [prediction, setPrediction] = useState<string>(); | |
| const [confidence, setConfidence] = useState<string>(); | |
| const [firstImages, setFirstImages] = useState<number>(0); | |
| const [secondImages, setSecondImages] = useState<number>(0); | |
| const [trainingComplete, setTrainingComplete] = useState<boolean>(); | |
| const [lossValue, setLossValue] = useState<number>(); |
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 logging | |
| import zipfile | |
| from io import BytesIO | |
| from boto3 import resource | |
| import gzip | |
| import io | |
| logger = logging.getLogger() | |
| logger.setLevel(logging.INFO) |
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
| dbt_project: | |
| target: dev | |
| outputs: | |
| dev: | |
| type: snowflake | |
| account: zzzz.eu-east-1 | |
| user: DEV_USER | |
| password: "{{ env_var('DBT_PASSWORD') }}" |
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
| image: fishtownanalytics/dbt:1.0.0 | |
| pipelines: | |
| branches: | |
| master: | |
| - step: | |
| name: 'setup and compile dbt' | |
| script: | |
| - cd dbt_project | |
| - dbt deps --profiles-dir ./profiles |
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
| resource "aws_s3_bucket" "incoming" { | |
| bucket = local.bucket_name | |
| acl = "private" | |
| server_side_encryption_configuration { | |
| rule { | |
| apply_server_side_encryption_by_default { | |
| sse_algorithm = "aws:kms" | |
| kms_master_key_id = aws_kms_key.ingest.id | |
| } |
OlderNewer