Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,16 +4,16 @@
|
|
| 4 |
import os
|
| 5 |
import streamlit as st
|
| 6 |
from PIL import Image
|
| 7 |
-
from transformers import AutoProcessor, AutoModelForTokenClassification
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
from transformers import
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def get_model_response(input_text, image, prompt):
|
| 13 |
-
# Load the pre-trained model
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
| 17 |
|
| 18 |
# Tokenize inputs
|
| 19 |
inputs = tokenizer(input_text, image, prompt, return_tensors="pt", max_length=512, truncation=True)
|
|
|
|
| 4 |
import os
|
| 5 |
import streamlit as st
|
| 6 |
from PIL import Image
|
|
|
|
| 7 |
|
| 8 |
+
# Load model directly
|
| 9 |
+
from transformers import AutoProcessor, AutoModelForSeq2SeqLM
|
| 10 |
+
|
| 11 |
+
|
| 12 |
|
| 13 |
def get_model_response(input_text, image, prompt):
|
| 14 |
+
# Load the pre-trained model
|
| 15 |
+
processor = AutoProcessor.from_pretrained("google/pix2struct-base")
|
| 16 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("google/pix2struct-base")
|
|
|
|
| 17 |
|
| 18 |
# Tokenize inputs
|
| 19 |
inputs = tokenizer(input_text, image, prompt, return_tensors="pt", max_length=512, truncation=True)
|