-
Notifications
You must be signed in to change notification settings - Fork 2
ocr endpoint 변경 #151
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
ocr endpoint 변경 #151
Conversation
Summary of ChangesHello @inoray, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 OCR 서비스와의 통신 방식을 업데이트하고 관련 설정을 중앙 집중화합니다. 기존 gRPC 기반의 OCR 호출을 HTTP POST 방식으로 전환하여 유연성을 높이고, OCR 엔드포인트의 IP 주소를 새로운 주소로 일괄 변경합니다. 이는 OCR 처리의 안정성과 유지보수성을 향상시키는 데 기여합니다. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
이 PR은 OCR 엔드포인트를 변경하고, 레거시 코드에서 gRPC 기반 OCR 호출을 HTTP 기반으로 전환하는 내용을 담고 있습니다. 엔드포인트 URL이 코드에 하드코딩되어 있어 유지보수 및 환경 구성에 어려움이 있을 수 있습니다. 이를 설정 파일이나 환경 변수로 분리하는 것이 좋습니다. 또한, 예외 처리와 텍스트 조합 로직에서 개선할 점이 보입니다.
| initialize Document Converter | ||
| ''' | ||
| self.ocr_endpoint = "http://192.168.81.170:48080/ocr" | ||
| self.ocr_endpoint = "http://192.168.73.172:48080/ocr" |
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.
OCR 엔드포인트 URL이 코드에 직접 하드코딩되어 있습니다. 이렇게 하면 개발, 스테이징, 운영 환경에 따라 코드를 수정해야 하므로 유지보수가 어렵고 잠재적인 보안 위험이 있습니다. os.environ.get() 등을 사용하여 환경 변수에서 URL을 읽어오도록 변경하는 것을 강력히 권장합니다.
| self.ocr_endpoint = "http://192.168.73.172:48080/ocr" | |
| self.ocr_endpoint = os.environ.get("OCR_ENDPOINT", "http://192.168.73.172:48080/ocr") |
| initialize Document Converter | ||
| ''' | ||
| self.ocr_endpoint = "http://192.168.81.170:48080/ocr" | ||
| self.ocr_endpoint = "http://192.168.73.172:48080/ocr" |
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.
OCR 엔드포인트 URL이 코드에 직접 하드코딩되어 있습니다. 이렇게 하면 개발, 스테이징, 운영 환경에 따라 코드를 수정해야 하므로 유지보수가 어렵고 잠재적인 보안 위험이 있습니다. os.environ.get() 등을 사용하여 환경 변수에서 URL을 읽어오도록 변경하는 것을 강력히 권장합니다.
| self.ocr_endpoint = "http://192.168.73.172:48080/ocr" | |
| self.ocr_endpoint = os.environ.get("OCR_ENDPOINT", "http://192.168.73.172:48080/ocr") |
| initialize Document Converter | ||
| ''' | ||
|
|
||
| self.ocr_endpoint = "http://192.168.73.172:48080/ocr" |
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.
OCR 엔드포인트 URL이 코드에 직접 하드코딩되어 있습니다. 이렇게 하면 개발, 스테이징, 운영 환경에 따라 코드를 수정해야 하므로 유지보수가 어렵고 잠재적인 보안 위험이 있습니다. os.environ.get() 등을 사용하여 환경 변수에서 URL을 읽어오도록 변경하는 것을 강력히 권장합니다.
| self.ocr_endpoint = "http://192.168.73.172:48080/ocr" | |
| self.ocr_endpoint = os.environ.get("OCR_ENDPOINT", "http://192.168.73.172:48080/ocr") |
| cell.text = "" | ||
| for result in response.results: | ||
| for t in rec_texts: | ||
| if len(cell.text) > 0: | ||
| cell.text += " " | ||
| cell.text += result.text if result else "" | ||
| except grpc.RpcError as e: | ||
| cell.text += t if t else "" |
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.
현재 텍스트 조합 로직은 rec_texts에 빈 문자열이 있을 경우 불필요한 공백을 추가하는 버그가 있습니다. 예를 들어, ['a', '', 'b']가 입력되면 결과는 'a b'가 됩니다. " ".join(filter(None, rec_texts))를 사용하면 빈 문자열을 제외하고 하나의 공백으로 텍스트를 합칠 수 있어 더 간결하고 정확합니다.
| cell.text = "" | |
| for result in response.results: | |
| for t in rec_texts: | |
| if len(cell.text) > 0: | |
| cell.text += " " | |
| cell.text += result.text if result else "" | |
| except grpc.RpcError as e: | |
| cell.text += t if t else "" | |
| cell.text = " ".join(filter(None, rec_texts)) |
| cell.text += result.text if result else "" | ||
| except grpc.RpcError as e: | ||
| cell.text += t if t else "" | ||
| except Exception as e: |
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.
Checklist: