Commit
Β·
f157a13
1
Parent(s):
9865789
Refactor app.py and requirements.txt: Reorganize imports and add 'accelerate' to dependencies
Browse files- app.py +5 -1
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,18 +1,22 @@
|
|
|
|
1 |
import json
|
2 |
import math
|
3 |
import os
|
4 |
import traceback
|
5 |
from io import BytesIO
|
6 |
from typing import Any, Dict, List, Optional, Tuple
|
7 |
-
|
8 |
import fitz # PyMuPDF
|
9 |
import gradio as gr
|
10 |
import requests
|
11 |
import torch
|
|
|
12 |
from PIL import Image, ImageDraw, ImageFont
|
13 |
from qwen_vl_utils import process_vision_info
|
14 |
from transformers import AutoModelForCausalLM, AutoProcessor
|
15 |
|
|
|
|
|
16 |
# Constants
|
17 |
MIN_PIXELS = 3136
|
18 |
MAX_PIXELS = 11289600
|
|
|
1 |
+
import spaces
|
2 |
import json
|
3 |
import math
|
4 |
import os
|
5 |
import traceback
|
6 |
from io import BytesIO
|
7 |
from typing import Any, Dict, List, Optional, Tuple
|
8 |
+
|
9 |
import fitz # PyMuPDF
|
10 |
import gradio as gr
|
11 |
import requests
|
12 |
import torch
|
13 |
+
from huggingface_hub import snapshot_download
|
14 |
from PIL import Image, ImageDraw, ImageFont
|
15 |
from qwen_vl_utils import process_vision_info
|
16 |
from transformers import AutoModelForCausalLM, AutoProcessor
|
17 |
|
18 |
+
print(torch.__version__)
|
19 |
+
|
20 |
# Constants
|
21 |
MIN_PIXELS = 3136
|
22 |
MAX_PIXELS = 11289600
|
requirements.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
huggingface_hub
|
|
|
2 |
transformers
|
3 |
torch
|
4 |
torchvision
|
|
|
1 |
huggingface_hub
|
2 |
+
accelerate
|
3 |
transformers
|
4 |
torch
|
5 |
torchvision
|