A curated collection of practical AI projects implementing OCR systems, RAG, AI agents, and other AI use cases.
Fix critical bug in non-PDF path, expose num_predict in UI, bump Streamlit to >=1.33.0
Tiioluwanifdf645f1bfcb
diff --git a/multimodal_apps/glm-ocr-pro/app.py b/multimodal_apps/glm-ocr-pro/app.pyindex 9572d62..8547ad6 100644--- a/multimodal_apps/glm-ocr-pro/app.py+++ b/multimodal_apps/glm-ocr-pro/app.py@@ -78,6 +78,8 @@ with col1:use_grayscale = st.checkbox("Enable Grayscale (Recommended)", value=default_gray)max_side = st.number_input("Max Side (px)", 400, 2400, default_side, step=100)pdf_render_scale = st.number_input("PDF Rendering Scale", 1.0, 3.0, float(default_render), step=0.1)+ num_predict = st.number_input("Max Output Tokens", 256, 8192, 2048, step=256)+if st.button("🚀 Extract Knowledge", type="primary", use_container_width=True):if uploaded_file is None:@@ -100,8 +102,8 @@ with col1:max_side=max_side,grayscale=use_grayscale,pdf_render_scale=pdf_render_scale,- ):- full_text += chunk+ num_predict=int(num_predict),+ ): full_text += chunk# Prettify rendering during streamoutput_placeholder.markdown(full_text)diff --git a/multimodal_apps/glm-ocr-pro/ocr_local.py b/multimodal_apps/glm-ocr-pro/ocr_local.pyindex d5a82d9..7d16b90 100644--- a/multimodal_apps/glm-ocr-pro/ocr_local.py+++ b/multimodal_apps/glm-ocr-pro/ocr_local.py@@ -145,7 +145,7 @@ def extract_markdown_local_stream(yield f"## Page {idx}\n\n"if optimize_images:page_bytes = _optimize_image_bytes(page_bytes, max_side=max_side, grayscale=grayscale)- yield from _run_single_image_local_stream(page_bytes, timeout_seconds=timeout_seconds, num_predict=num_predict)+ yield from _run_single_image_local_stream(file_bytes, timeout_seconds=timeout_seconds, num_predict=num_predict)yield "\n\n---\n\n"else:if optimize_images:diff --git a/multimodal_apps/glm-ocr-pro/requirements.txt b/multimodal_apps/glm-ocr-pro/requirements.txtindex 0ee2930..215dbdd 100644--- a/multimodal_apps/glm-ocr-pro/requirements.txt+++ b/multimodal_apps/glm-ocr-pro/requirements.txt@@ -1,3 +1,3 @@-streamlit>=1.31.0+streamlit>=1.33.0pypdfium2>=4.30.0pillow>=10.0.0\ No newline at end of file