Update app.py
Browse files
app.py
CHANGED
|
@@ -33,13 +33,8 @@ def predict(image, prompt=None):
|
|
| 33 |
result = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 34 |
return result
|
| 35 |
|
| 36 |
-
Hàm mock xử lý ảnh — chỉ để test UI
|
| 37 |
-
def mock_predict(image, prompt=None):
|
| 38 |
-
return f"Fake OCR result for image. Prompt: {prompt or 'N/A'}"
|
| 39 |
-
|
| 40 |
demo = gr.Interface(
|
| 41 |
-
|
| 42 |
-
fn=mock_predict,
|
| 43 |
inputs=[
|
| 44 |
gr.Image(type="pil", label="Tải ảnh tài liệu lên"),
|
| 45 |
gr.Textbox(label="Gợi ý (tuỳ chọn)", placeholder="VD: Trích số hóa đơn")
|
|
@@ -48,5 +43,5 @@ demo = gr.Interface(
|
|
| 48 |
title="Camel-Doc OCR - Trích xuất văn bản từ ảnh"
|
| 49 |
)
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
|
|
|
| 33 |
result = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 34 |
return result
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
demo = gr.Interface(
|
| 37 |
+
fn=predict,
|
|
|
|
| 38 |
inputs=[
|
| 39 |
gr.Image(type="pil", label="Tải ảnh tài liệu lên"),
|
| 40 |
gr.Textbox(label="Gợi ý (tuỳ chọn)", placeholder="VD: Trích số hóa đơn")
|
|
|
|
| 43 |
title="Camel-Doc OCR - Trích xuất văn bản từ ảnh"
|
| 44 |
)
|
| 45 |
|
| 46 |
+
if __name__ == "__main__":
|
| 47 |
+
demo.launch()
|