DanielDDDS commited on
Commit
cfa1e45
verified
1 Parent(s): 794b65e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline(
5
+ "token-classification",
6
+ model="DanielDDDS/hebrew-recipe-modification-ner",
7
+ aggregation_strategy="simple"
8
+ )
9
+
10
+ def predict(text):
11
+ if isinstance(text, list):
12
+ text = text[0]
13
+ preds = pipe(text)
14
+ return {"results": preds}
15
+
16
+ demo = gr.Interface(
17
+ fn=predict,
18
+ inputs=gr.Textbox(label="Hebrew comment", placeholder="讗驻砖专 诇讛讞诇讬祝 讞诪讗讛 讘砖诪谉 拽讜拽讜住"),
19
+ outputs="json",
20
+ title="Hebrew Recipe Modification Extractor",
21
+ description="Extract recipe modifications from Hebrew YouTube comments",
22
+ allow_flagging="never"
23
+ )
24
+
25
+ demo.queue(max_size=10).launch()