misc: add GLiNER2 Modal demo (extract_json + classify_text)#1530
Open
vish86 wants to merge 4 commits intomodal-labs:mainfrom
Open
misc: add GLiNER2 Modal demo (extract_json + classify_text)#1530vish86 wants to merge 4 commits intomodal-labs:mainfrom
vish86 wants to merge 4 commits intomodal-labs:mainfrom
Conversation
Runs extract_json and classify_text on the same text with a Modal cls and requirements file co-located under misc/. Made-with: Cursor
Remove co-located requirements file; dependencies live in the example script. Made-with: Cursor
| @@ -0,0 +1,72 @@ | |||
| # --- | |||
| # cmd: ["python", "misc/kafka_microbatch_etl.py", "--batch=25", "--timeout-s=5", "--local=true"] | |||
Contributor
There was a problem hiding this comment.
🔴 Frontmatter cmd uses python but file has no if __name__ == "__main__" block
The frontmatter specifies cmd: ["python", "misc/kafka_microbatch_etl.py", ...], but the file uses @app.local_entrypoint() (line 68) with no if __name__ == "__main__" block. Running with python directly will import the module and exit without executing anything — @app.local_entrypoint() is only invoked by modal run. Every other example in this repo that uses cmd: ["python", ...] has a if __name__ == "__main__" block (e.g., 06_gpu_and_ml/gpu_snapshot.py:62, misc/queue_simple.py:51). The documented command silently does nothing.
Suggested change
| # cmd: ["python", "misc/kafka_microbatch_etl.py", "--batch=25", "--timeout-s=5", "--local=true"] | |
| # cmd: ["modal", "run", "misc/kafka_microbatch_etl.py", "--batch=25", "--timeout-s=5", "--local"] |
Was this helpful? React with 👍 or 👎 to provide feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
misc/gliner2_modal_demo.py: loadfastino/gliner2-base-v1in@modal.enter(), runextract_jsonandclassify_texton the same string in one remote method.pip_installon the image (single file, no separate requirements).Run
From the repo root:
Optional:
modal run misc/gliner2_modal_demo.py --text "Your paragraph here."Notes
misc/pattern (see misc README).