Spaces:
Build error
Build error
freemt
commited on
Commit
·
bf87f43
1
Parent(s):
79618dd
Debug
Browse files- ubee/__main__.py +19 -2
ubee/__main__.py
CHANGED
@@ -1,4 +1,21 @@
|
|
1 |
-
"""Gen ubee main.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
# pylint: disable=unused-import, wrong-import-position, wrong-import-order, too-many-locals, broad-except, line-too-long
|
3 |
|
4 |
import sys
|
@@ -49,7 +66,7 @@ try:
|
|
49 |
clas = load_model("clas-l-user")
|
50 |
except Exception as _:
|
51 |
ic(["load_model(\"clas-l-user\")", _])
|
52 |
-
_ = clas("love", "liebe, hate you, test", False)
|
53 |
print(_)
|
54 |
|
55 |
raise SystemExit("Exit by intention")
|
|
|
1 |
+
"""Gen ubee main.
|
2 |
+
|
3 |
+
private
|
4 |
+
url = 'https://hf.space/embed/mikeee/zero-shot/+/api/predict'
|
5 |
+
resp = httpx.post(
|
6 |
+
url,
|
7 |
+
json={"data": ["love", ",".join(["liebe", "this is test", "hate you"]), False]},
|
8 |
+
timeout=httpx.Timeout(None, connect=3),
|
9 |
+
)
|
10 |
+
resp.json()
|
11 |
+
{'data': [{'label': 'liebe',
|
12 |
+
'confidences': [{'label': 'liebe', 'confidence': 0.8688847422599792},
|
13 |
+
{'label': 'this is test', 'confidence': 0.12558135390281677},
|
14 |
+
{'label': 'hate you', 'confidence': 0.005533925257623196}]}],
|
15 |
+
'duration': 0.265749454498291,
|
16 |
+
'average_duration': 4.639325571060181}
|
17 |
+
|
18 |
+
"""
|
19 |
# pylint: disable=unused-import, wrong-import-position, wrong-import-order, too-many-locals, broad-except, line-too-long
|
20 |
|
21 |
import sys
|
|
|
66 |
clas = load_model("clas-l-user")
|
67 |
except Exception as _:
|
68 |
ic(["load_model(\"clas-l-user\")", _])
|
69 |
+
_ = clas("love", ["liebe", "hate you", "test"], False)
|
70 |
print(_)
|
71 |
|
72 |
raise SystemExit("Exit by intention")
|