| import gradio as gr |
| from transformers import pipeline |
|
|
| pipe = pipeline( |
| "token-classification", |
| model="DanielDDDS/hebrew-recipe-modification-ner", |
| aggregation_strategy="simple" |
| ) |
|
|
| def predict(text): |
| if isinstance(text, list): |
| text = text[0] |
| preds = pipe(text) |
| return {"results": preds} |
|
|
| demo = gr.Interface( |
| fn=predict, |
| inputs=gr.Textbox(label="Hebrew comment", placeholder="ืืคืฉืจ ืืืืืืฃ ืืืื ืืฉืื ืงืืงืืก"), |
| outputs="json", |
| title="Hebrew Recipe Modification Extractor", |
| description="Extract recipe modifications from Hebrew YouTube comments", |
| api_name="predict" |
| ) |
|
|
| demo.queue(max_size=10).launch() |