Spaces:
Running
Running
saylee-m
commited on
Commit
•
ca94c32
1
Parent(s):
f50a20b
added more comments
Browse files
app.py
CHANGED
@@ -109,6 +109,7 @@ def process_document_donut(image_array, question):
|
|
109 |
return op
|
110 |
|
111 |
def process_document_pg(image_array, question):
|
|
|
112 |
print("called loaded model")
|
113 |
model, processor = loaded_models.get("paligemma")
|
114 |
|
@@ -162,12 +163,16 @@ def generate_answer_paligemma(image_array, question):
|
|
162 |
return "sorry :("
|
163 |
|
164 |
def generate_answers(image_path, question, selected_model=model_choices[0]):
|
|
|
165 |
try:
|
166 |
if selected_model == "donut":
|
|
|
167 |
answer = generate_answer_donut(image_path, question)
|
168 |
elif selected_model == "paligemma":
|
|
|
169 |
answer = generate_answer_paligemma(image_path, question)
|
170 |
else:
|
|
|
171 |
answer = generate_answer_idefics(image_path, question)
|
172 |
|
173 |
return [answer] #[donut_answer, pg_answer, idf_answer]
|
|
|
109 |
return op
|
110 |
|
111 |
def process_document_pg(image_array, question):
|
112 |
+
print("qustion :", question)
|
113 |
print("called loaded model")
|
114 |
model, processor = loaded_models.get("paligemma")
|
115 |
|
|
|
163 |
return "sorry :("
|
164 |
|
165 |
def generate_answers(image_path, question, selected_model=model_choices[0]):
|
166 |
+
print("selected model: ", selected_model)
|
167 |
try:
|
168 |
if selected_model == "donut":
|
169 |
+
print("generate answers donut")
|
170 |
answer = generate_answer_donut(image_path, question)
|
171 |
elif selected_model == "paligemma":
|
172 |
+
print("generate answers pg")
|
173 |
answer = generate_answer_paligemma(image_path, question)
|
174 |
else:
|
175 |
+
print("generate answers idf2")
|
176 |
answer = generate_answer_idefics(image_path, question)
|
177 |
|
178 |
return [answer] #[donut_answer, pg_answer, idf_answer]
|