alibidaran
commited on
Commit
•
2cdb9d7
1
Parent(s):
5334465
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,8 @@ import torch
|
|
2 |
from transformers import AutoProcessor,AutoModelForCausalLM
|
3 |
import gradio as gr
|
4 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
|
|
|
5 |
def generate_caption(image,length):
|
6 |
encoded=processor(images=image, return_tensors="pt").to(device)
|
7 |
pixels=encoded['pixel_values'].to(device)
|
|
|
2 |
from transformers import AutoProcessor,AutoModelForCausalLM
|
3 |
import gradio as gr
|
4 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
5 |
+
processor=AutoProcessor.from_pretrained("alibidaran/General_image_captioning")
|
6 |
+
model=AutoModelForCausalLM.from_pretrained("alibidaran/General_image_captioning").to(device)
|
7 |
def generate_caption(image,length):
|
8 |
encoded=processor(images=image, return_tensors="pt").to(device)
|
9 |
pixels=encoded['pixel_values'].to(device)
|