Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR consolidates file removals, dependency updates, and refactors training, FastAPI, and Django code for the ShortZip project.
- Removed legacy tokenization, notebooks, and requirement files in favor of updated scripts and requirements.
- Updated
model_notebook/training.pywith new imports, metrics viaevaluate, and adjusted data paths. - Refactored FastAPI/Django views, tightened error handling, and updated settings for dynamic host/port via JSON.
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tokenization_kobert.py | Entire tokenizer implementation removed |
| model_notebook/training.py | Fixed imports, switched to evaluate, data path updates |
| fastapi/requirements.txt | Simplified dependencies to core packages |
| fastapi/main.py | Commented out legacy summarization function; added text preprocessing |
| django_app/ARTICLE_SUMMARY2/ARTICLE_SUMMARY2/settings.py | Added dynamic FastAPI host/port loading |
| django_app/ARTICLE_SUMMARY2/board/views.py | Enhanced error responses, adjusted URL-check logic |
Comments suppressed due to low confidence (4)
tokenization_kobert.py:1
- The entire tokenizer implementation was removed, which will break any code depending on
KoBertTokenizer. If this was unintentional, please restore or migrate the tokenizer logic.
diff --git a/tokenization_kobert.py b/tokenization_kobert.py
model_notebook/training.py:115
- Variable
dfis undefined here; likely intended to betrain_df. This will raise a NameError at runtime.
hg_dataset = Dataset(pa.Table.from_pandas(df))
fastapi/requirements.txt:2
- Critical dependencies such as
transformersandrequestswere removed from requirements, which will break imports used in the FastAPI code.
fastapi
fastapi/main.py:10
- [nitpick] Function name
textProcessingdoes not follow snake_case naming convention. Consider renaming totext_processing.
def textProcessing( text: str) -> str:
Comment on lines
+88
to
+92
| fastapi.close() | ||
|
|
||
| with open(BASE_DIR / 'db_connect.json') as db_connect: | ||
| db_data = json.load(db_connect) | ||
| db_connect.close() |
There was a problem hiding this comment.
Calling .close() on the file handle inside a with open(...) block is redundant because with already handles closing.
Suggested change
| fastapi.close() | |
| with open(BASE_DIR / 'db_connect.json') as db_connect: | |
| db_data = json.load(db_connect) | |
| db_connect.close() | |
| with open(BASE_DIR / 'db_connect.json') as db_connect: | |
| db_data = json.load(db_connect) |
| if models.NewsArticleInfo.objects.filter(url=url) : | ||
| # 해당 URL을 가진 기사가 데이터베이스에 존재하면, 수정일자를 비교하여 최신 버전인지 확인. | ||
| if models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date__isnull=True)) or models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date = crawl_data_dict.get('modify_date'))): | ||
| if (models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date__isnull=True)) and crawl_data_dict.get('modify_date') != -1 ) or models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date = crawl_data_dict.get('modify_date'))): |
There was a problem hiding this comment.
[nitpick] This conditional is hard to read. Consider extracting parts into well-named boolean variables or simplifying the logic for clarity.
Suggested change
| if (models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date__isnull=True)) and crawl_data_dict.get('modify_date') != -1 ) or models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date = crawl_data_dict.get('modify_date'))): | |
| is_new_article_with_modify_date = models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date__isnull=True)) and crawl_data_dict.get('modify_date') != -1 | |
| is_article_up_to_date = models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date=crawl_data_dict.get('modify_date'))) | |
| if is_new_article_with_modify_date or is_article_up_to_date: |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Can you review a my code.