Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
from span_marker import SpanMarkerModel
|
4 |
+
|
5 |
+
|
6 |
+
def function(messages):
|
7 |
+
# Download from the 🤗 Hub
|
8 |
+
model = SpanMarkerModel.from_pretrained("tomaarsen/span-marker-bert-base-acronyms")
|
9 |
+
# Run inference
|
10 |
+
# text = st.text_area('enter some text:')
|
11 |
+
|
12 |
+
if text:
|
13 |
+
out = model.predict(messages)
|
14 |
+
|
15 |
+
return st.json(out)
|
16 |
+
|
17 |
+
|
18 |
+
demo = gr.ChatInterface(fn=function, type="messages", examples=["hello", "hola", "merhaba"], title="Abbreviation-Detector")
|