Spaces:
Runtime error
Runtime error
add req data
Browse files
app.py
CHANGED
@@ -13,16 +13,19 @@ def query(payload):
|
|
13 |
response = req.post(API_URL, headers=headers, json=payload)
|
14 |
return response.json()
|
15 |
|
16 |
-
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
def pygen_func(code_nl):
|
20 |
inputs = {'code_nl': code_nl}
|
21 |
-
payload = json.dumps(inputs)
|
22 |
# prediction = req.request(CT5_METHOD, CT5_URL, data=payload)
|
23 |
-
prediction = req.request(CT5_METHOD, CT5_URL, json=
|
24 |
-
answer = json.loads(prediction.content.decode("utf-8"))
|
25 |
-
return 'BOOM! ' + output + ' BOOM!!: ' + answer
|
26 |
|
27 |
iface = gr.Interface(pygen_func,
|
28 |
[
|
|
|
13 |
response = req.post(API_URL, headers=headers, json=payload)
|
14 |
return response.json()
|
15 |
|
16 |
+
|
17 |
+
function_code = 'inputs: def pad(tensor, paddings, mode: "CONSTANT", name: nil) _op(:pad, tensor, paddings, mode: mode, name: name) end </s>'
|
18 |
+
req_data = {"inputs": function_code}
|
19 |
+
output = query(req_data)
|
20 |
|
21 |
|
22 |
def pygen_func(code_nl):
|
23 |
inputs = {'code_nl': code_nl}
|
24 |
+
# payload = json.dumps(inputs)
|
25 |
# prediction = req.request(CT5_METHOD, CT5_URL, data=payload)
|
26 |
+
# prediction = req.request(CT5_METHOD, CT5_URL, json=req_data)
|
27 |
+
# answer = json.loads(prediction.content.decode("utf-8"))
|
28 |
+
return 'BOOM! ' + output # + ' BOOM!!: ' + answer
|
29 |
|
30 |
iface = gr.Interface(pygen_func,
|
31 |
[
|