Python
Python Packaging: pyproject.toml로 프로젝트 설정을 간편하게!
Python Packaging: pyproject.toml로 프로젝트 설정을 간편하게!
2024.04.25Python 프로젝트를 개발하다 보면 프로젝트 설정과 관련된 여러 파일들을 다뤄야 합니다. setup.py, requirements.txt, Pipfile, setup.cfg 등 다양한 파일들이 존재하죠. 하지만 이제 pyproject.toml이라는 새로운 표준이 등장했습니다. 이 글에서는 pyproject.toml에 대해 자세히 알아보고, 어떻게 구성하고 사용하는지 살펴보겠습니다.pyproject.toml 소개pyproject.toml은 Python 프로젝트의 빌드 시스템과 관련된 설정을 포함하는 파일입니다. 패키징 도구뿐만 아니라 linters, type checkers 등 다양한 도구들에서 사용됩니다. pyproject.toml에는 세 가지 TOML 테이블이 있을 수 있습니다.[build-syste..
Google Gemini API 사용하기 - Python (2) : 사용법과 실습
Google Gemini API 사용하기 - Python (2) : 사용법과 실습
2023.12.18Google DeepMind가 개발한 'Gemini'는 멀티모달을 위해 설계된 AI 모델의 집합체입니다. Vertex AI Gemini API를 통해, 사용자는 Gemini Pro Vision와 Gemini Pro 모델에 접근할 수 있게 되었습니다. 이 두 모델은 각각 다양한 멀티미디어 데이터와 자연어 처리 기능을 지원합니다. Gemini Pro: 자연어 처리 작업, 다중턴 텍스트 및 코드 채팅, 그리고 코드 생성과 같은 작업을 처리하는 데에 최적화되어 있습니다. Gemini Pro Vision: 멀티모달 프롬프트를 지원합니다. 사용자는 텍스트, 이미지, 비디오를 포함한 프롬프트 요청을 할 수 있으며, 텍스트나 코드 형태의 응답을 받을 수 있습니다. Gemini API의 모델 정보에 대한 자세한 사양은 ..
Google Gemini API 사용하기 - Python (1) : 사전준비
Google Gemini API 사용하기 - Python (1) : 사전준비
2023.12.152023년 12월 6일, Google은 Gemini(제미나이)라는 Large Multimodal Model을 세상에 공개했습니다. 이 모델은 텍스트, 이미지, 오디오에 이르기까지 광범위하게 다양한 형태의 데이터 처리를 가능하게 합니다. 물론 발표 이후 시연 영상 편집 논란과 실제 사용자들 사이에서는 GPT-4와의 비교를 통해 기대에 못 미치는 것으로 평가되는 경우도 있었습니다. 구글의 제미나이(Gemini) 살펴보기: 우리 생활에 가져올 변화 구글이 현지시간 6일, GPT-4를 능가하는 새로운 AI 모델인 '제미나이(Gemini 또는 제미니)'를 발표했습니다. 이번 발표는 당초 내년 초로 예상되었던 출시 일정을 앞당겨 깜짝 발표를 했습니다. '제미 yunwoong.tistory.com 12월 13일 Go..
OpenAI Assistants API: 시작하기 (Python)
OpenAI Assistants API: 시작하기 (Python)
2023.12.07OpenAI의 API를 활용하는 개발자 수가 200만 명을 넘어섰습니다. 이제 새로운 기술이 형성되고 활용되는 방식에 중대한 변화가 일어나고 있음이 분명해졌습니다. 지난 2023년 11월 6일에 있었던 OpenAI의 첫 개발자 컨퍼런스인 DevDay는 AI의 발전과 도구들에 대한 최신 정보를 소개하는 자리였습니다. 이 중에서도 특히 주목할 만한 것은 지능적이고 반응적인 AI 어시스턴트를 구축할 수 있는 OpenAI Assistants API였습니다. 이 API는 현재 AI 기술을 적용하고 이해하는 방식에 있어 중요한 역할을 하고 있으며, 개발자들에게 새로운 가능성을 열어주고 있습니다. 경험이 풍부한 개발자든, 이제 막 시작한 초보 개발자든, 오늘날의 기술 환경에서 OpenAI Assistants API를..
GPT-4V(ision)를 이용한 이미지 기반 추론 - (Python)
GPT-4V(ision)를 이용한 이미지 기반 추론 - (Python)
2023.12.03이미지 기반 추론은 이미지 내의 객체나 요소들을 기반으로 논리적인 결론이나 추정을 도출하는 과정입니다. GPT-4V를 활용하면, 이미지 내의 정보를 분석하여 구체적인 추론을 수행할 수 있습니다. #1. 필수 패키지 설치 및 준비 GPT-4V를 활용한 이미지 인식 프로젝트를 시작하기 전에, 필요한 Python 패키지들을 설치하고 준비하는 과정이 필요합니다. 1) 패키지 설치 먼저, 필요한 Python 라이브러리를 설치해야 합니다. 이를 위해 Python의 패키지 관리자인 pip를 사용합니다. 다음 명령어를 통해 필요한 패키지들을 설치할 수 있습니다. pip install openai requests pillow matplotlib 이 명령어는 OpenAI의 API를 사용하기 위한 openai, 웹에서 이미..
GPT-4V(ision)를 이용한 얼굴 인식(Face Recognition) - (Python)
GPT-4V(ision)를 이용한 얼굴 인식(Face Recognition) - (Python)
2023.11.27얼굴 인식(Face Recognition)은 이미지 내의 인물을 식별하고 구별하는 기술입니다. GPT-4V를 활용하면, 다양한 이미지에서 특정 인물을 식별하고 관련 정보를 추출하는 것이 가능해집니다. #1. 필수 패키지 설치 및 준비 GPT-4V를 활용한 이미지 인식 프로젝트를 시작하기 전에, 필요한 Python 패키지들을 설치하고 준비하는 과정이 필요합니다. 1) 패키지 설치 먼저, 필요한 Python 라이브러리를 설치해야 합니다. 이를 위해 Python의 패키지 관리자인 pip를 사용합니다. 다음 명령어를 통해 필요한 패키지들을 설치할 수 있습니다. pip install openai requests pillow matplotlib 이 명령어는 OpenAI의 API를 사용하기 위한 openai, 웹에서..
GPT-4V(ision)를 이용한 OCR - (Python)
GPT-4V(ision)를 이용한 OCR - (Python)
2023.11.26이번 글에서는 GPT-4V를 활용한 OCR에 대해 알아보겠습니다. OCR (Optical Character Recognition)은 이미지에서 텍스트를 추출하고 인식하는 기술입니다. 이 기술은 문서 스캔, 명함 인식, 자동 번호판 인식 등 다양한 분야에서 활용됩니다. GPT-4V를 이용하면, 이미지 내의 텍스트를 효과적으로 추출하고 처리할 수 있습니다. #1. 필수 패키지 설치 및 준비 GPT-4V를 활용한 이미지 인식 프로젝트를 시작하기 전에, 필요한 Python 패키지들을 설치하고 준비하는 과정이 필요합니다. 1) 패키지 설치 먼저, 필요한 Python 라이브러리를 설치해야 합니다. 이를 위해 Python의 패키지 관리자인 pip를 사용합니다. 다음 명령어를 통해 필요한 패키지들을 설치할 수 있습니다..
GPT-4V(ision)를 이용한 객체 탐지(Object Detection) - (Python)
GPT-4V(ision)를 이용한 객체 탐지(Object Detection) - (Python)
2023.11.26이번 글에서는 GPT-4V를 활용하여 객체 탐지(Object Detection)에 대해 알아보겠습니다. 객체 탐지(Object Detection)는 이미지 내 특정 객체를 식별하고, 그 위치를 정확하게 파악하는 과정을 말하며 이미지 분류(Classification)와 위치 파악(Localization)을 동시에 수행하는 이미지 인식 기술입니다. 이미지 분류(Classification)는 이미지 내의 객체가 무엇인지 식별하고 위치 파악(Localization)은 그 객체가 이미지 내 어디 곳에 위치해 있는지를 나타냅니다. #1. 필수 패키지 설치 및 준비 GPT-4V를 활용한 이미지 인식 프로젝트를 시작하기 전에, 필요한 Python 패키지들을 설치하고 준비하는 과정이 필요합니다. 1) 패키지 설치 먼저,..
GPT-4 with Vision API를 사용하여 이미지 인식 (Python)
GPT-4 with Vision API를 사용하여 이미지 인식 (Python)
2023.11.112023년 11월 6일, OpenAI 개발자 컨퍼런스에서 소개된 후 많은 개발자들의 관심을 끌고 있는 GPT-4의 새로운 기능, 'GPT-4 with Vision'은 이미지를 입력으로 받아 질문에 답변할 수 있는 능력을 제공합니다. 이전까지 언어 모델 시스템은 단일 입력 모달리티, 텍스트에 한정되어 있었지만, 이제 'gpt-4-vision-preview' 모델을 이용하여 이미지와 텍스트 모두를 처리할 수 있게 되었습니다. GPT-4V의 이미지 이해 GPT-4V는 이미지와 관련된 텍스트 정보를 처리하여 이미지 내의 객체, 장면, 상황 등을 이해하고 설명할 수 있습니다. 이를 위해 우리는 GPT-4에게 이미지와 관련된 질문을 할 수 있으며, 모델은 이미지 내용을 분석하여 답변을 제공합니다. 이미지 처리를 위..
[ 오류수정 ] AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?
[ 오류수정 ] AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?
2023.07.20pandas 2.0.0 버전 이후부터 'append()' Method가 완전히 제거되었기 때문에 더 이상 작동하지 않습니다. 이로 인해 이전에 'append()' Method를 참조하던 코드는 다음과 같은 오류가 발생합니다. AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'? pandas DataFrame을 다른 DataFrame 또는 다른 Python 객체(예: 딕셔너리)와 어떻게 연결할 수 있는지, 예제를 보여드리도록 하겠습니다. pandas v2.0.0+에서 pandas DataFrames 연결하기 이전 pandas 버전에서는 'append()' Method를 사용하여 아래와 같이 DataFram..
[ Python ] googletrans을 이용한 간단한 번역 프로그램
[ Python ] googletrans을 이용한 간단한 번역 프로그램
2023.01.30Python의 googletrans 라이브러리를 사용하여 텍스트와 문장을 다른 언어로 빠르게 번역할 수 있습니다. 매우 간단하며 몇 줄의 코드만 있으면 됩니다. Install Python 환경에서 간단하게 googletrans만 설치하면 사용이 가능합니다. pip 를 이용하여 googletrans 설치를 진행하면 3.0.0 버전으로 설치가 되지만 3.0.0 버전은 오류가 있으니 아래와 같이 버전을 지정하여 4.0.0rc1 버전으로 설치하시기 바랍니다. pip install googletrans==4.0.0rc1 Import packages from googletrans import Translator options = ['text', 'file'] Class declaration Googletrans는 ..
[Python] *args와 **kwargs 사용방법
[Python] *args와 **kwargs 사용방법
2022.11.21Python에서 *args, **kwars를 사용하는 함수를 볼 때가 있습니다. C를 접하신분은 * 를 보고 Python에도 포인터가 있다고 오해할 수도 있지만 다행히도 포인터는 아닙니다. 분명 arguments를 받는 인자인 것 같은데, Python 입문자들을 혼동스럽게 만드는 *args와 **kwars에 대해서 알아보겠습니다. (작성 하실 때 *args와 **kwars 라는 이름을 사용할 필요는 없습니다. args와 kwars는 변수명이기때문에 다른 변수명 앞에 * 또는 **를 붙여 사용하면 됩니다. 예를들어 *vars나 **arguments 등으로 바꾸어 사용하시면 됩니다.) 간단히 argument를 입력받아 print하는 예를 들겠습니다. def print_args(arg1, arg2): prin..