Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,4 @@
|
|
| 1 |
import os
|
| 2 |
-
import re
|
| 3 |
-
import gradio as gr
|
| 4 |
-
import sys
|
| 5 |
-
import argparse
|
| 6 |
-
import json
|
| 7 |
-
import time
|
| 8 |
-
import hashlib
|
| 9 |
-
import base64
|
| 10 |
-
from PIL import Image
|
| 11 |
-
|
| 12 |
-
from gradio_image_annotation import image_annotator
|
| 13 |
-
|
| 14 |
-
from werkzeug.utils import secure_filename # Add this import
|
| 15 |
-
from utils.system_prompt import SHORT_SYSTEM_PROMPT_WITH_THINKING
|
| 16 |
-
from utils.lua_converter import LuaConverter
|
| 17 |
-
from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
|
| 18 |
-
from qwen_vl_utils import process_vision_info
|
| 19 |
-
import torch
|
| 20 |
-
from utils.lua2lrt import lua_to_lrtemplate
|
| 21 |
-
from huggingface_hub import snapshot_download
|
| 22 |
-
import spaces
|
| 23 |
-
|
| 24 |
-
|
| 25 |
import subprocess
|
| 26 |
import os
|
| 27 |
from pathlib import Path
|
|
@@ -53,6 +30,29 @@ def run_command(cmd, cwd=None):
|
|
| 53 |
for cmd, cwd in commands:
|
| 54 |
run_command(cmd, cwd)
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
def extract_json_from_answer(answer):
|
| 57 |
"""
|
| 58 |
Extract configuration data from the answer string and convert to JSON
|
|
|
|
| 1 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import subprocess
|
| 3 |
import os
|
| 4 |
from pathlib import Path
|
|
|
|
| 30 |
for cmd, cwd in commands:
|
| 31 |
run_command(cmd, cwd)
|
| 32 |
|
| 33 |
+
import re
|
| 34 |
+
import gradio as gr
|
| 35 |
+
import sys
|
| 36 |
+
import argparse
|
| 37 |
+
import json
|
| 38 |
+
import time
|
| 39 |
+
import hashlib
|
| 40 |
+
import base64
|
| 41 |
+
from PIL import Image
|
| 42 |
+
|
| 43 |
+
from gradio_image_annotation import image_annotator
|
| 44 |
+
|
| 45 |
+
from werkzeug.utils import secure_filename # Add this import
|
| 46 |
+
from utils.system_prompt import SHORT_SYSTEM_PROMPT_WITH_THINKING
|
| 47 |
+
from utils.lua_converter import LuaConverter
|
| 48 |
+
from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
|
| 49 |
+
from qwen_vl_utils import process_vision_info
|
| 50 |
+
import torch
|
| 51 |
+
from utils.lua2lrt import lua_to_lrtemplate
|
| 52 |
+
from huggingface_hub import snapshot_download
|
| 53 |
+
import spaces
|
| 54 |
+
|
| 55 |
+
|
| 56 |
def extract_json_from_answer(answer):
|
| 57 |
"""
|
| 58 |
Extract configuration data from the answer string and convert to JSON
|