Create usage.py
Browse files
usage.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
extractor = pipeline("text2text-generation", model="location")
|
| 3 |
+
|
| 4 |
+
intent = " I will visit you at botanic garden."
|
| 5 |
+
|
| 6 |
+
label=extractor(intent)[0]["generated_text"]
|
| 7 |
+
if label=="":
|
| 8 |
+
label="No location detected"
|
| 9 |
+
print (label )
|