Skip to content
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

Issue: Redundant Imports for torch and PIL.Image in gradio_demo.py #86

Open
yabi90 opened this issue Nov 17, 2024 · 0 comments · May be fixed by #87
Open

Issue: Redundant Imports for torch and PIL.Image in gradio_demo.py #86

yabi90 opened this issue Nov 17, 2024 · 0 comments · May be fixed by #87

Comments

@yabi90
Copy link

yabi90 commented Nov 17, 2024

Description:

In the current code, there are multiple imports of torch and PIL.Image. This redundancy can be eliminated by consolidating these imports into a single block to maintain cleaner code and improve readability.

Current Code:

from typing import Optional

import gradio as gr
import numpy as np
import torch
from PIL import Image
import io


import base64, os
from utils import check_ocr_box, get_yolo_model, get_caption_model_processor, get_som_labeled_img
import torch
from PIL import Image

Suggested Fix:

Consolidate the imports for torch and PIL.Image into a single block, as shown below:

from typing import Optional
import gradio as gr
import numpy as np
import io
import base64, os
from utils import check_ocr_box, get_yolo_model, get_caption_model_processor, get_som_labeled_img
import torch
from PIL import Image

Impact:

  • Reduced redundancy in imports.
  • Improved code clarity and maintainability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant