Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import requests
|
|
5 |
import gradio as gr
|
6 |
import transformers
|
7 |
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor
|
8 |
-
from peft import PeftModel
|
9 |
|
10 |
|
11 |
if torch.cuda.is_available():
|
@@ -145,10 +145,9 @@ def get_response_from_openai(prompt, model="gpt-3.5-turbo", max_output_tokens=25
|
|
145 |
return ret
|
146 |
|
147 |
## deplot models
|
|
|
148 |
if device == "cuda":
|
149 |
-
model_deplot =
|
150 |
-
else:
|
151 |
-
model_deplot = Pix2StructForConditionalGeneration.from_pretrained("google/deplot", torch_dtype=torch.bfloat16)
|
152 |
processor_deplot = Pix2StructProcessor.from_pretrained("google/deplot")
|
153 |
|
154 |
def evaluate(
|
|
|
5 |
import gradio as gr
|
6 |
import transformers
|
7 |
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor
|
8 |
+
#from peft import PeftModel
|
9 |
|
10 |
|
11 |
if torch.cuda.is_available():
|
|
|
145 |
return ret
|
146 |
|
147 |
## deplot models
|
148 |
+
model_deplot = Pix2StructForConditionalGeneration.from_pretrained("google/deplot", torch_dtype=torch.bfloat16).
|
149 |
if device == "cuda":
|
150 |
+
model_deplot = model_deplot.to(0)
|
|
|
|
|
151 |
processor_deplot = Pix2StructProcessor.from_pretrained("google/deplot")
|
152 |
|
153 |
def evaluate(
|