Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,13 @@
|
|
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 |
code_nl = "function for db connection"
|
5 |
|
6 |
CT5_URL = "https://api-inference.huggingface.co/models/stmnk/codet5-small-code-summarization-python"
|
@@ -40,7 +47,7 @@ def docgen_func(function_code, min_length, max_length, top_k, top_p, temp, repet
|
|
40 |
}
|
41 |
output = query(req_data)
|
42 |
if type(output) is list:
|
43 |
-
return f'""
|
44 |
else:
|
45 |
msg = str(output)
|
46 |
if msg == "{'error': 'Model stmnk/codet5-small-code-summarization-python is currently loading', 'estimated_time': 20}":
|
@@ -74,3 +81,4 @@ iface = gr.Interface(
|
|
74 |
|
75 |
# iface.launch(share=True) # "share" not allowed in hf spaces? (!?!?)
|
76 |
iface.launch()
|
|
|
|
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 |
+
def greet(name):
|
5 |
+
return "Hello " + name + "!!"
|
6 |
+
|
7 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
8 |
+
iface.launch()
|
9 |
+
|
10 |
+
"""
|
11 |
code_nl = "function for db connection"
|
12 |
|
13 |
CT5_URL = "https://api-inference.huggingface.co/models/stmnk/codet5-small-code-summarization-python"
|
|
|
47 |
}
|
48 |
output = query(req_data)
|
49 |
if type(output) is list:
|
50 |
+
return f'""{output[0]["generated_text"]}""' # 3 quotations "" -> 3 * "
|
51 |
else:
|
52 |
msg = str(output)
|
53 |
if msg == "{'error': 'Model stmnk/codet5-small-code-summarization-python is currently loading', 'estimated_time': 20}":
|
|
|
81 |
|
82 |
# iface.launch(share=True) # "share" not allowed in hf spaces? (!?!?)
|
83 |
iface.launch()
|
84 |
+
"""
|