Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,31 +6,9 @@ import torch.backends.cudnn as cudnn
|
|
6 |
import gradio as gr
|
7 |
|
8 |
os.system('git lfs install')
|
9 |
-
os.system("git clone https://huggingface.co/Pluto0616/L2_InternVL
|
10 |
-
|
11 |
-
import
|
12 |
-
import logging
|
13 |
-
from datetime import datetime
|
14 |
-
|
15 |
-
def load_json(file_name: str):
|
16 |
-
if isinstance(file_name, str) and file_name.endswith("json"):
|
17 |
-
with open(file_name, 'r') as file:
|
18 |
-
data = json.load(file)
|
19 |
-
else:
|
20 |
-
raise ValueError("The file path you passed in is not a json file path.")
|
21 |
-
|
22 |
-
return data
|
23 |
-
|
24 |
-
def init_logger(outputs_dir):
|
25 |
-
current_time = datetime.now().strftime("%b%d_%H-%M-%S")
|
26 |
-
os.makedirs(os.path.join(outputs_dir, "logs"), exist_ok=True)
|
27 |
-
log_path = os.path.join(outputs_dir, "logs", "{}.txt".format(current_time))
|
28 |
-
logging.basicConfig(
|
29 |
-
level=logging.INFO,
|
30 |
-
format="%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s || %(message)s",
|
31 |
-
handlers=[logging.StreamHandler(), logging.FileHandler(log_path)],
|
32 |
-
)
|
33 |
-
|
34 |
from demo import ConversationalAgent, CustomTheme
|
35 |
|
36 |
FOOD_EXAMPLES = "./L2_InternVL/demo/food_for_demo.json"
|
|
|
6 |
import gradio as gr
|
7 |
|
8 |
os.system('git lfs install')
|
9 |
+
os.system("git clone https://huggingface.co/Pluto0616/L2_InternVL
|
10 |
+
os.system('cd ./L2_InternVL')
|
11 |
+
from utils import load_json, init_logger
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
from demo import ConversationalAgent, CustomTheme
|
13 |
|
14 |
FOOD_EXAMPLES = "./L2_InternVL/demo/food_for_demo.json"
|