Spaces:
Runtime error
Runtime error
Commit
·
8679651
1
Parent(s):
48f2a33
update app.py
Browse files- app.py +11 -26
- requirements.txt +1 -10
app.py
CHANGED
|
@@ -3,32 +3,25 @@ import warnings
|
|
| 3 |
warnings.filterwarnings('ignore')
|
| 4 |
|
| 5 |
import subprocess, io, os, sys, time
|
| 6 |
-
|
| 7 |
-
# os.system("pip install gradio==4.42.0")
|
| 8 |
-
|
| 9 |
import gradio as gr
|
| 10 |
from loguru import logger
|
| 11 |
|
| 12 |
-
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
| 13 |
-
os.system("pip list")
|
| 14 |
-
|
| 15 |
-
# if os.environ.get('IS_MY_DEBUG') is None:
|
| 16 |
-
# result = subprocess.run(['pip', 'install', '-e', 'GroundingDINO'], check=True)
|
| 17 |
-
# logger.info(f'pip install GroundingDINO = {result}')
|
| 18 |
-
|
| 19 |
-
logger.info(f"Start app...")
|
| 20 |
-
os.system("pip list")
|
| 21 |
-
# result = subprocess.run(['pip', 'list'], check=True)
|
| 22 |
-
# logger.info(f'pip list = {result}')
|
| 23 |
-
|
| 24 |
-
sys.path.insert(0, './GroundingDINO')
|
| 25 |
-
|
| 26 |
import argparse
|
| 27 |
import copy
|
| 28 |
|
| 29 |
import numpy as np
|
| 30 |
import torch
|
| 31 |
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
try:
|
| 34 |
# Grounding DINO
|
|
@@ -40,25 +33,17 @@ try:
|
|
| 40 |
except Exception as e:
|
| 41 |
logger.error(f"import GroundingDINO error: {str(e)}")
|
| 42 |
|
| 43 |
-
|
| 44 |
-
import numpy as np
|
| 45 |
-
import matplotlib
|
| 46 |
matplotlib.use('AGG')
|
| 47 |
plt = matplotlib.pyplot
|
| 48 |
-
# import matplotlib.pyplot as plt
|
| 49 |
|
| 50 |
groundingdino_enable = True
|
| 51 |
sam_enable = True
|
| 52 |
inpainting_enable = True
|
| 53 |
ram_enable = False
|
| 54 |
-
|
| 55 |
lama_cleaner_enable = True
|
| 56 |
-
|
| 57 |
kosmos_enable = False
|
| 58 |
|
| 59 |
-
# qwen_enable = True
|
| 60 |
-
# from qwen_utils import *
|
| 61 |
-
|
| 62 |
if os.environ.get('IS_MY_DEBUG') is not None:
|
| 63 |
sam_enable = False
|
| 64 |
ram_enable = False
|
|
|
|
| 3 |
warnings.filterwarnings('ignore')
|
| 4 |
|
| 5 |
import subprocess, io, os, sys, time
|
|
|
|
|
|
|
|
|
|
| 6 |
import gradio as gr
|
| 7 |
from loguru import logger
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
import argparse
|
| 10 |
import copy
|
| 11 |
|
| 12 |
import numpy as np
|
| 13 |
import torch
|
| 14 |
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
| 15 |
+
import cv2
|
| 16 |
+
import numpy as np
|
| 17 |
+
import matplotlib
|
| 18 |
+
|
| 19 |
+
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
| 20 |
+
os.system("pip list")
|
| 21 |
+
|
| 22 |
+
logger.info(f"Start app...")
|
| 23 |
+
|
| 24 |
+
sys.path.insert(0, './GroundingDINO')
|
| 25 |
|
| 26 |
try:
|
| 27 |
# Grounding DINO
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
logger.error(f"import GroundingDINO error: {str(e)}")
|
| 35 |
|
| 36 |
+
|
|
|
|
|
|
|
| 37 |
matplotlib.use('AGG')
|
| 38 |
plt = matplotlib.pyplot
|
|
|
|
| 39 |
|
| 40 |
groundingdino_enable = True
|
| 41 |
sam_enable = True
|
| 42 |
inpainting_enable = True
|
| 43 |
ram_enable = False
|
|
|
|
| 44 |
lama_cleaner_enable = True
|
|
|
|
| 45 |
kosmos_enable = False
|
| 46 |
|
|
|
|
|
|
|
|
|
|
| 47 |
if os.environ.get('IS_MY_DEBUG') is not None:
|
| 48 |
sam_enable = False
|
| 49 |
ram_enable = False
|
requirements.txt
CHANGED
|
@@ -29,23 +29,14 @@ pynvml
|
|
| 29 |
sentencepiece
|
| 30 |
loguru
|
| 31 |
|
| 32 |
-
|
| 33 |
-
transformers==4.37
|
| 34 |
# transformers@git+https://github.com/huggingface/transformers.git@main
|
| 35 |
|
| 36 |
# lama-cleaner==1.2.4
|
| 37 |
lama-cleaner@git+https://github.com/yizhangliu/lama-cleaner.git@main
|
| 38 |
|
| 39 |
-
# mmcv==2.1.0
|
| 40 |
mmengine
|
| 41 |
openmim==0.3.9
|
| 42 |
|
| 43 |
-
# tiktoken
|
| 44 |
-
# einops
|
| 45 |
-
# transformers_stream_generator==0.0.4
|
| 46 |
-
# tensorboard
|
| 47 |
-
# bitsandbytes
|
| 48 |
-
# auto-gptq
|
| 49 |
-
|
| 50 |
tencentcloud-sdk-python
|
| 51 |
|
|
|
|
| 29 |
sentencepiece
|
| 30 |
loguru
|
| 31 |
|
| 32 |
+
transformers==4.27.4
|
|
|
|
| 33 |
# transformers@git+https://github.com/huggingface/transformers.git@main
|
| 34 |
|
| 35 |
# lama-cleaner==1.2.4
|
| 36 |
lama-cleaner@git+https://github.com/yizhangliu/lama-cleaner.git@main
|
| 37 |
|
|
|
|
| 38 |
mmengine
|
| 39 |
openmim==0.3.9
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
tencentcloud-sdk-python
|
| 42 |
|