Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,11 @@ from lavis.models import load_model_and_preprocess
|
|
10 |
|
11 |
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, AutoModelForSeq2SeqLM
|
12 |
import gradio as gr
|
|
|
13 |
|
14 |
def prepare_data(image, question):
|
|
|
|
|
15 |
image = vis_processors["eval"](image).unsqueeze(0).to(device)
|
16 |
question = txt_processors["eval"](question)
|
17 |
samples = {"image": image, "text_input": [question]}
|
|
|
10 |
|
11 |
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, AutoModelForSeq2SeqLM
|
12 |
import gradio as gr
|
13 |
+
import torch, gc
|
14 |
|
15 |
def prepare_data(image, question):
|
16 |
+
gc.collect()
|
17 |
+
torch.cuda.empty_cache()
|
18 |
image = vis_processors["eval"](image).unsqueeze(0).to(device)
|
19 |
question = txt_processors["eval"](question)
|
20 |
samples = {"image": image, "text_input": [question]}
|