Spaces:
Runtime error
Runtime error
Commit
Β·
cd5a9e7
1
Parent(s):
d9bb429
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
|
| 5 |
+
pipe = pipeline("text2text-generation", model="hackathon-somos-nlp-2023/bertin-gpt-j-6b-ner-es")
|
| 6 |
+
|
| 7 |
+
def predict(text):
|
| 8 |
+
return pipe(f"text: {text}, entities:")["generated_text"]
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(
|
| 11 |
+
fn=predict,
|
| 12 |
+
inputs='text',
|
| 13 |
+
outputs='text',
|
| 14 |
+
examples=[["Yo hoy voy a hablar de mujeres en el mundo del arte, porque me ha leΓdo un libro fantΓ‘stico que se llama Historia del arte sin hombres, de Katie Hesel."]]
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
iface.launch()
|