Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import easyocr
|
|
2 |
from gradio_client import Client, handle_file
|
3 |
import pandas as pd
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
clientImg = Client("dj-dawgs-ipd/IPD-Image-ViT-Finetune")
|
7 |
clientEngText = Client("dj-dawgs-ipd/IPD-Text-English-Finetune")
|
@@ -16,9 +17,13 @@ def extract_text(image):
|
|
16 |
return ' '.join([l for l in data])
|
17 |
|
18 |
def predict(image):
|
|
|
|
|
|
|
|
|
19 |
|
20 |
imgResult = clientImg.predict(
|
21 |
-
|
22 |
api_name="/predict"
|
23 |
)
|
24 |
|
|
|
2 |
from gradio_client import Client, handle_file
|
3 |
import pandas as pd
|
4 |
import gradio as gr
|
5 |
+
import io
|
6 |
|
7 |
clientImg = Client("dj-dawgs-ipd/IPD-Image-ViT-Finetune")
|
8 |
clientEngText = Client("dj-dawgs-ipd/IPD-Text-English-Finetune")
|
|
|
17 |
return ' '.join([l for l in data])
|
18 |
|
19 |
def predict(image):
|
20 |
+
|
21 |
+
buffered = io.BytesIO()
|
22 |
+
image.save(buffered, format="PNG")
|
23 |
+
img_str = base64.b64encode(buffered.getvalue()).decode()
|
24 |
|
25 |
imgResult = clientImg.predict(
|
26 |
+
img_str,
|
27 |
api_name="/predict"
|
28 |
)
|
29 |
|