Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,6 @@ processor = AutoProcessor.from_pretrained(ckpt)
|
|
14 |
|
15 |
@spaces.GPU
|
16 |
def extract_text(image):
|
17 |
-
print(image)
|
18 |
# Convert image to RGB
|
19 |
image = Image.open(image).convert("RGB")
|
20 |
|
@@ -38,6 +37,8 @@ def extract_text(image):
|
|
38 |
outputs = model.generate(**inputs, max_new_tokens=250)
|
39 |
result = processor.decode(outputs[0], skip_special_tokens=True)
|
40 |
|
|
|
|
|
41 |
# Clean up the output to remove the prompt and assistant text
|
42 |
if "assistant" in result.lower():
|
43 |
result = result[result.lower().find("assistant") + len("assistant"):].strip()
|
|
|
14 |
|
15 |
@spaces.GPU
|
16 |
def extract_text(image):
|
|
|
17 |
# Convert image to RGB
|
18 |
image = Image.open(image).convert("RGB")
|
19 |
|
|
|
37 |
outputs = model.generate(**inputs, max_new_tokens=250)
|
38 |
result = processor.decode(outputs[0], skip_special_tokens=True)
|
39 |
|
40 |
+
print(result)
|
41 |
+
|
42 |
# Clean up the output to remove the prompt and assistant text
|
43 |
if "assistant" in result.lower():
|
44 |
result = result[result.lower().find("assistant") + len("assistant"):].strip()
|