1. formdata로 FastAPI에 값 보내기 formdata로 파일만 보내는 경우가 있지만, 때로는 formdata로 파일도 보내고 싶고 string이나 integer 등등 단순 데이터도 같이 보내고 싶을 수 있다 //vue.js async stopSoundToKeyword () { this.isLoading = true this.isRecording = false this.mediaRecorder.stop() this.mediaRecorder.onstop = (event) => { const blob = new Blob(this.audioArray, {type: 'audio/mp3'}) this.audioArray.splice(0) const formData = new FormData() form..
1. static file serving FastAPI에서 만든 정적 파일(static file, HTML, CSS, Javascript, 이미지, 음성파일 등)을 front에 제공하고 싶을때, 한가지 방법 정적 파일 경로를 지정하고, frontend에서 해당 경로로 직접 접근하여 파일을 사용하는 방법 공식 문서 피셜 https://fastapi.tiangolo.com/tutorial/static-files/ Static Files - FastAPI Static Files You can serve static files automatically from a directory using StaticFiles. Use StaticFiles Import StaticFiles. "Mount" a StaticFi..
1. 422 unprocessable entity front에서 axios로 back(fastapi)으로 데이터 요청을 보낼때, 볼 수 있는 에러 vue.js에서 title과 keyword를 text로 입력받고.. //vue.js 자동 작성 //중간 생략 async createAIReview () { axios .post(`http://127.0.0.1:8000/reviews/gpt`, { title: this.form.title, keyword: this.form.keyword, writer: this.form.writer, char: this.form.char }) .then(result => { console.log(result) this.form.content = result.review this..
1. dataset class 1-1) torch.utils.data에 존재하는 라이브러리? 주어진 Vanilla data를 “모델이 좋아하는 dataset”으로 변환시켜줌 원하는 augmentation이나 preprocessing 방식도 추가 가능 미리 만든 MNIST같은 데이터셋 말고도 어떠한 데이터에 대해서도 새로 만든 dataset class가 필요함 1-2) 기본 구조 Mydataset이라는 class는 torch.utils.data의 Dataset의 기능들을 전부 가졌으면 해서 Dataset을 상속받음 다음 3가지는 dataset이라는 class가 가져야할 기본 기능이다. 1) __init__는 Mydataset이 처음 선언되면 최초 1번 호출되는 함수 보통 Vanilla data의 위치나 경..
다음과 같이 dockerfile이 작성되었고 FROM python:3.8 WORKDIR /SubPjt2/backend/ RUN pip install --upgrade pip RUN pip install matplotlib RUN pip install tensorflow RUN pip install CMake RUN pip install dlib RUN pip install torch RUN pip install torchvision FROM node:16.18 WORKDIR /SubPjt2/backend/ COPY --from=0 . . COPY . . RUN npm install EXPOSE 3001 CMD ["npm", "start"] 이렇게 구성된 dockerfile에서 다음과 같은 python-s..
2. acceleration 시간에 따른 거리의 변화량이 속도이고 속도의 변화량이 가속도(acceleration) 2-1) python list와 numpy array python list는 각각의 element를 개별 object 단위로 저장 numpy array는 비슷한 data type들을 메모리 상 동일한? 비슷한? 위치에 한번에 잡아서 처리함 python list는 element 개별 주소를 부여하여 저장 numpy array는 동일한 type의 element를 한번에 묶어서 저장 numpy array는 c를 기반으로 만들어져 python list에 비해 가속(속도가 빠름)되었음 실제로 numpy array가 0.1초 정도 빠름 2-2) python과 C python도 C를 기반으로 만들어..