Spaces:
Sleeping
Sleeping
| 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() |