File size: 725 Bytes
cfa1e45 635e373 cfa1e45 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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" # <--- this line forces the endpoint name
)
demo.queue(max_size=10).launch() |