Spaces:
Sleeping
Sleeping
File size: 613 Bytes
82d8ff7 20300f6 98df634 20300f6 82d8ff7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import trackio
import gradio as gr
from hezar.models import Model
import trackio
# Load your model
crnn = Model.load("hezarai/crnn-base-fa-v2")
# Define prediction function
def ocr_predict(image):
texts = crnn.predict([image])
return "\n".join(texts)
# Create Gradio interface
iface = gr.Interface(
fn=ocr_predict,
inputs=gr.Image(type="filepath"), # Accepts uploaded images
outputs=gr.Textbox(label="Detected Text"),
title="Farsi OCR",
description="Upload an image and extract Farsi text using CRNN."
)
# Launch the app
if __name__ == "__main__":
iface.launch()
trackio.show() |