Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import requests
|
2 |
+
# headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
3 |
+
# API_URL = "https://api-inference.huggingface.co/models/kepinsam/ind-to-bbc-nmt-v5"
|
4 |
+
# def query(payload):
|
5 |
+
# response = requests.post(API_URL, headers=headers, json=payload)
|
6 |
+
# return response.json()
|
7 |
+
# data = query({"inputs": ""})
|
8 |
+
|
9 |
+
# ---
|
10 |
+
|
11 |
+
# # Use a pipeline as a high-level helper
|
12 |
+
# from transformers import pipeline
|
13 |
+
|
14 |
+
# pipe = pipeline("text2text-generation", model="kepinsam/ind-to-bbc-nmt-v5")
|
15 |
+
|
16 |
+
# ---
|
17 |
+
|
18 |
+
import requests
|
19 |
+
|
20 |
+
API_URL = "https://api-inference.huggingface.co/models/kepinsam/ind-to-bbc-nmt-v5"
|
21 |
+
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
22 |
+
|
23 |
+
def query(payload):
|
24 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
25 |
+
return response.json()
|
26 |
+
|
27 |
+
output = query({
|
28 |
+
"inputs": "Andi dan Budi pergi bersama ke sekolah dengan tas merah.",
|
29 |
+
})
|