Update app.py
Browse files
app.py
CHANGED
@@ -105,10 +105,10 @@ def generate_report(frontal_path, lateral_path, indication, technique, compariso
|
|
105 |
get_grounding=grounding
|
106 |
).to("cpu")
|
107 |
|
108 |
-
|
109 |
image_size_keys = [k for k in processed.keys() if "image_sizes" in k]
|
110 |
for k in image_size_keys:
|
111 |
-
processed.pop(k)
|
112 |
|
113 |
outputs = MODEL_STATE["model"].generate(
|
114 |
**processed,
|
@@ -139,10 +139,11 @@ def ground_phrase(frontal_path, phrase):
|
|
139 |
return_tensors="pt"
|
140 |
).to("cpu")
|
141 |
|
142 |
-
#
|
|
|
143 |
image_size_keys = [k for k in processed.keys() if "image_sizes" in k]
|
144 |
for k in image_size_keys:
|
145 |
-
processed.pop(k)
|
146 |
|
147 |
outputs = MODEL_STATE["model"].generate(
|
148 |
**processed,
|
@@ -235,4 +236,4 @@ with gr.Blocks(title="MAIRA-2 Medical Assistant") as demo:
|
|
235 |
outputs=pg_output
|
236 |
)
|
237 |
|
238 |
-
demo.launch()
|
|
|
105 |
get_grounding=grounding
|
106 |
).to("cpu")
|
107 |
|
108 |
+
processed = dict(processed)
|
109 |
image_size_keys = [k for k in processed.keys() if "image_sizes" in k]
|
110 |
for k in image_size_keys:
|
111 |
+
processed.pop(k, None)
|
112 |
|
113 |
outputs = MODEL_STATE["model"].generate(
|
114 |
**processed,
|
|
|
139 |
return_tensors="pt"
|
140 |
).to("cpu")
|
141 |
|
142 |
+
# Convert to regular dict and remove image size related keys
|
143 |
+
processed = dict(processed)
|
144 |
image_size_keys = [k for k in processed.keys() if "image_sizes" in k]
|
145 |
for k in image_size_keys:
|
146 |
+
processed.pop(k, None)
|
147 |
|
148 |
outputs = MODEL_STATE["model"].generate(
|
149 |
**processed,
|
|
|
236 |
outputs=pg_output
|
237 |
)
|
238 |
|
239 |
+
demo.launch()
|