Spaces:
Build error
Build error
Update app.py
Browse files78 unmodified lines798081828384858678 unmodified linestext = 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()78 unmodified lines79808182838485868788899091929394959697989910078 unmodified linestext = processor.batch_decode(output_ids, skip_special_tokens=True)[0]return text.strip()# 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 placeholderreturn 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 Actionsimg_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