Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,8 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, set_seed
|
|
3 |
from transformers import pipeline
|
4 |
import os
|
5 |
|
6 |
-
description = """# <p style="text-align: center; color: white;">
|
7 |
-
<span style='color: white;'>This is a demo to generate code with <a href="
|
8 |
|
9 |
token = os.environ["HUB_TOKEN"]
|
10 |
device="cuda:0"
|
@@ -30,26 +30,29 @@ with demo:
|
|
30 |
with gr.Row():
|
31 |
with gr.Column():
|
32 |
code = gr.Textbox(lines=10, label="Input code")
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
51 |
run = gr.Button()
|
52 |
-
with gr.Column():
|
53 |
output = gr.Textbox(lines=10, label="Generated code")
|
54 |
|
55 |
event = run.click(code_generation, [code, max_tokens, temperature, seed], output)
|
|
|
3 |
from transformers import pipeline
|
4 |
import os
|
5 |
|
6 |
+
description = """# <p style="text-align: center; color: white;"> 🎅 <span style='color: #ff75b3;'>SantaCoder:</span> Code Generation </p>
|
7 |
+
<span style='color: white;'>This is a demo to generate code with <a href="https://huggingface.co/bigcode/santacoder" style="color: #ff75b3;">SantaCoder</a>, a 1.1B model for code generation in Python, Java & JavaScript.</span>"""
|
8 |
|
9 |
token = os.environ["HUB_TOKEN"]
|
10 |
device="cuda:0"
|
|
|
30 |
with gr.Row():
|
31 |
with gr.Column():
|
32 |
code = gr.Textbox(lines=10, label="Input code")
|
33 |
+
|
34 |
+
with gradio.Accordion("Advanced settings"):
|
35 |
+
max_tokens= gr.Slider(
|
36 |
+
minimum=8,
|
37 |
+
maximum=1024,
|
38 |
+
step=1,
|
39 |
+
value=16,
|
40 |
+
label="Number of tokens to generate",
|
41 |
+
)
|
42 |
+
temperature = gr.Slider(
|
43 |
+
minimum=0.1,
|
44 |
+
maximum=2.5,
|
45 |
+
step=0.1,
|
46 |
+
value=0.2,
|
47 |
+
label="Temperature",
|
48 |
+
)
|
49 |
+
seed = gr.Slider(
|
50 |
+
minimum=0,
|
51 |
+
maximum=1000,
|
52 |
+
step=1,
|
53 |
+
label="Random seed to use for the generation"
|
54 |
+
)
|
55 |
run = gr.Button()
|
|
|
56 |
output = gr.Textbox(lines=10, label="Generated code")
|
57 |
|
58 |
event = run.click(code_generation, [code, max_tokens, temperature, seed], output)
|