pauurbano commited on
Commit
d209ea0
·
verified ·
1 Parent(s): 5ac2553

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -4
app.py CHANGED
@@ -1,8 +1,35 @@
1
  import gradio as gr
 
 
2
 
3
- def saluda(nom):
4
- return "Hola " + nom
5
 
6
- demo = gr.Interface(fn=saluda, inputs="text", outputs="text")
7
 
8
- demo.launch(auth=("admin", "1234"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
+ from gradio_client import Client
4
 
5
+ client = Client("abidlabs/whisper")
 
6
 
7
+ ner_pipeline = pipeline(model="projecte-aina/roberta-base-ca-v2-cased-ner")
8
 
9
+ def ner(text):
10
+ output = ner_pipeline(text)
11
+ return {"text": text, "entities": output}
12
+
13
+ def neteja():
14
+ return [gr.Textbox(value=None), gr.HighlightedText(value=None)]
15
+
16
+ with gr.Blocks(theme=gr.themes.Glass()) as demo:
17
+ gr.Markdown(
18
+ """
19
+ # Reconeixament d'entitats nomenades en català
20
+ Escriu o copia un text i troba les seves entitats
21
+ """)
22
+ with gr.Row():
23
+ with gr.Column():
24
+ inp = gr.Textbox(label="text", placeholder="Escriu aquí...")
25
+ with gr.Row():
26
+ b1 = gr.Button(value="Neteja")
27
+ b2 = gr.Button("Troba entitats", variant="primary")
28
+ out = gr.HighlightedText(label="sortida")
29
+
30
+ examples = gr.Examples(examples=exemples, inputs=inp, label="Exemple:")
31
+
32
+ b1.click(neteja, outputs=[inp, out])
33
+ b2.click(ner, inputs=inp, outputs=out)
34
+
35
+ demo.launch(auth=("admin", "admin"))