Spaces:
Runtime error
Runtime error
File size: 625 Bytes
2b7da55 8259bb2 2b7da55 65ad43e 2b7da55 65ad43e 2b7da55 65ad43e 2b7da55 4f6c52f 7d8fd50 4f6c52f 2b7da55 4f6c52f 2b7da55 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import json
import gradio as gr
import requests as req
code_nl = "function for db connection"
CT5_URL = "https://api-inference.huggingface.co/models/deepset/roberta-base-squad2"
CT5_METHOD = 'POST'
def pygen_func(code_nl):
inputs = {'code_nl': code_nl}
payload = json.dumps(inputs)
prediction = req.request(CT5_METHOD, CT5_URL, data=payload)
answer = json.loads(prediction.content.decode("utf-8"))
return 'BOOM!'
iface = gr.Interface(pygen_func,
[
gr.inputs.Textbox(lines=7, label="Context", default=code_nl),
],
gr.outputs.Textbox(label="Completion"))
iface.launch(share=True) |