Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from transformers import MllamaForConditionalGeneration, AutoProcessor, TextIteratorStreamer , AutoModel
|
2 |
from qwen_vl_utils import process_vision_info
|
3 |
from PIL import Image
|
4 |
import requests
|
@@ -19,7 +19,7 @@ logger = logging.getLogger(__name__)
|
|
19 |
|
20 |
# Load model and processor
|
21 |
ckpt ="Qwen/Qwen2-VL-72B-Instruct-AWQ"
|
22 |
-
model =
|
23 |
processor = AutoProcessor.from_pretrained(ckpt,trust_remote_code=True)
|
24 |
|
25 |
class DocumentState:
|
@@ -125,7 +125,7 @@ def process_uploaded_file(file):
|
|
125 |
logger.error(f"Error in process_file: {str(e)}")
|
126 |
return "An error occurred while processing the file. Please try again."
|
127 |
|
128 |
-
@spaces.GPU()
|
129 |
def bot_streaming(prompt_option, max_new_tokens=8192):
|
130 |
try:
|
131 |
# Define predetermined prompts
|
|
|
1 |
+
from transformers import MllamaForConditionalGeneration, AutoProcessor, TextIteratorStreamer , AutoModel,Qwen2VLForConditionalGeneration
|
2 |
from qwen_vl_utils import process_vision_info
|
3 |
from PIL import Image
|
4 |
import requests
|
|
|
19 |
|
20 |
# Load model and processor
|
21 |
ckpt ="Qwen/Qwen2-VL-72B-Instruct-AWQ"
|
22 |
+
model = Qwen2VLForConditionalGeneration.from_pretrained(ckpt, torch_dtype=torch.bfloat16,trust_remote_code=True).to("cuda")
|
23 |
processor = AutoProcessor.from_pretrained(ckpt,trust_remote_code=True)
|
24 |
|
25 |
class DocumentState:
|
|
|
125 |
logger.error(f"Error in process_file: {str(e)}")
|
126 |
return "An error occurred while processing the file. Please try again."
|
127 |
|
128 |
+
@spaces.GPU(duration=660)
|
129 |
def bot_streaming(prompt_option, max_new_tokens=8192):
|
130 |
try:
|
131 |
# Define predetermined prompts
|