Spaces:
Build error
Build error
Update app.py
Browse files78 unmodified lines798081828384858682838485868788899091929394959697989910078 unmodified lines text = processor.batch_decode(output_ids, skip_special_tokens=True)[0] return text.strip()
# Gradio Interfaceiface = gr.Interface(fn=image_to_text, inputs="image", outputs="text", title="Image to Text with Donut")
demo.launch()
# Placeholder function for analysis (you can customize it with Qwen or another model)def analyze_text(text): # For now, just echo the text as a placeholder return f"Analyzed Pattern: {text}"
# Gradio Interface using Blockswith gr.Blocks() as demo: with gr.Row(): img_input = gr.Image(type="pil", label="Input Image") text_output = gr.Textbox(label="Extracted Text") prediction_output = gr.Textbox(label="Pattern Analysis Prediction")
# Define Button Actions img_input.change(image_to_text, img_input, text_output) text_output.change(analyze_text, text_output, prediction_output)
# Start the Gradio interfaceif __name__ == "__main__": demo.launch()app.py+19-5