Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,10 @@ import gradio as gr
|
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM, set_seed, pipeline
|
3 |
|
4 |
|
5 |
-
title = "Code
|
6 |
-
description = "This
|
7 |
-
|
|
|
8 |
|
9 |
EXAMPLE_1 = "def sort_function(arr):\n n = len(arr)\n \n # Traverse through all array elements\n for i in range(n):\n \n # Last i elements are already in place\n for j in range(0, n-i-1):\n \n # traverse the array from 0 to n-i-1\n # Swap if the element found is greater\n # than the next element\n if arr[j] > arr[j+1]:\n arr[j], arr[j+1] = arr[j+1], arr[j]"
|
10 |
EXAMPLE_2 = "from sklearn import model_selection\nX_train, X_test, Y_train, Y_test = model_selection.train_test_split(X, Y, test_size=0.2)"
|
@@ -59,7 +60,6 @@ iface = gr.Interface(
|
|
59 |
outputs=gr.Textbox(label="Predicted explanation", lines=10),
|
60 |
examples=example,
|
61 |
layout="horizontal",
|
62 |
-
theme="peach",
|
63 |
description=description,
|
64 |
title=title
|
65 |
)
|
|
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM, set_seed, pipeline
|
3 |
|
4 |
|
5 |
+
title = "🎅 Santa Explains Code"
|
6 |
+
description = "This space converts Python code into English text that explains its function using [SantaCoder-Code-To-Text](https://huggingface.co/bigcode/santacoder-code-to-text),
|
7 |
+
a code generation model that has been fine-tuned on the [github-jupyter-code-to-text](https://huggingface.co/datasets/codeparrot/github-jupyter-code-to-text) dataset.
|
8 |
+
This dataset includes Python code accompanied by docstrings that explain it. The data was sourced from Jupyter notebooks."
|
9 |
|
10 |
EXAMPLE_1 = "def sort_function(arr):\n n = len(arr)\n \n # Traverse through all array elements\n for i in range(n):\n \n # Last i elements are already in place\n for j in range(0, n-i-1):\n \n # traverse the array from 0 to n-i-1\n # Swap if the element found is greater\n # than the next element\n if arr[j] > arr[j+1]:\n arr[j], arr[j+1] = arr[j+1], arr[j]"
|
11 |
EXAMPLE_2 = "from sklearn import model_selection\nX_train, X_test, Y_train, Y_test = model_selection.train_test_split(X, Y, test_size=0.2)"
|
|
|
60 |
outputs=gr.Textbox(label="Predicted explanation", lines=10),
|
61 |
examples=example,
|
62 |
layout="horizontal",
|
|
|
63 |
description=description,
|
64 |
title=title
|
65 |
)
|