Spaces:
Running
on
Zero
Running
on
Zero
Adding Zero Space
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from PIL import Image
|
|
5 |
from transformers import MllamaForConditionalGeneration, AutoProcessor
|
6 |
from peft import PeftModel
|
7 |
from huggingface_hub import login
|
|
|
8 |
|
9 |
# Login to Hugging Face
|
10 |
if "HF_TOKEN" not in os.environ:
|
@@ -23,6 +24,7 @@ model = MllamaForConditionalGeneration.from_pretrained(
|
|
23 |
)
|
24 |
model = PeftModel.from_pretrained(model, lora_weights_path)
|
25 |
|
|
|
26 |
def inference(image, question):
|
27 |
# Prepare input
|
28 |
messages = [
|
|
|
5 |
from transformers import MllamaForConditionalGeneration, AutoProcessor
|
6 |
from peft import PeftModel
|
7 |
from huggingface_hub import login
|
8 |
+
import spaces
|
9 |
|
10 |
# Login to Hugging Face
|
11 |
if "HF_TOKEN" not in os.environ:
|
|
|
24 |
)
|
25 |
model = PeftModel.from_pretrained(model, lora_weights_path)
|
26 |
|
27 |
+
@spaces.GPU
|
28 |
def inference(image, question):
|
29 |
# Prepare input
|
30 |
messages = [
|