Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
# Use a pipeline as a high-level helper
|
5 |
-
from transformers import pipeline
|
6 |
-
|
7 |
-
pipe = pipeline("text-generation", model="stabilityai/stablecode-instruct-alpha-3b")
|
8 |
|
9 |
model.cuda()
|
10 |
-
inputs = tokenizer("###Instruction\nGenerate a python function to find number of CPU cores###Response\n", return_tensors="pt").to("cuda")
|
11 |
tokens = model.generate(
|
12 |
**inputs,
|
13 |
max_new_tokens=480,
|
14 |
temperature=0.2,
|
15 |
do_sample=True,
|
16 |
)
|
17 |
-
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
gr.Interface.load("models/stabilityai/stablecode-instruct-alpha-3b").launch()
|
|
|
|
|
|
|
|
|
4 |
|
5 |
model.cuda()
|
|
|
6 |
tokens = model.generate(
|
7 |
**inputs,
|
8 |
max_new_tokens=480,
|
9 |
temperature=0.2,
|
10 |
do_sample=True,
|
11 |
)
|
|