Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import json; import gradio as gr; import requests as req
|
2 |
from strings import dfs_code, function_code, real_docstring, tree_code, insert_code, display_code, article_string, descr_string
|
3 |
|
4 |
"""
|
@@ -23,7 +23,10 @@ code_nl = "function for db connection"
|
|
23 |
CT5_URL = "https://api-inference.huggingface.co/models/stmnk/codet5-small-code-summarization-python"
|
24 |
CT5_METHOD = 'POST'
|
25 |
API_URL = CT5_URL
|
26 |
-
|
|
|
|
|
|
|
27 |
|
28 |
def query(payload):
|
29 |
response = req.post(API_URL, headers=headers, json=payload)
|
|
|
1 |
+
import os; import json; import gradio as gr; import requests as req
|
2 |
from strings import dfs_code, function_code, real_docstring, tree_code, insert_code, display_code, article_string, descr_string
|
3 |
|
4 |
"""
|
|
|
23 |
CT5_URL = "https://api-inference.huggingface.co/models/stmnk/codet5-small-code-summarization-python"
|
24 |
CT5_METHOD = 'POST'
|
25 |
API_URL = CT5_URL
|
26 |
+
API_KEY = os.environ.get("API_KEY")
|
27 |
+
|
28 |
+
# headers = {"Authorization": "Bearer api_UhCKXKyqxJOpOcbvrZurQFqmVNZRTtxVfl"}
|
29 |
+
headers = {"Authorization": f"Bearer {API_KEY}"}
|
30 |
|
31 |
def query(payload):
|
32 |
response = req.post(API_URL, headers=headers, json=payload)
|