Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import torch
|
|
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, StoppingCriteria, StoppingCriteriaList
|
3 |
|
4 |
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-tuned-alpha-7b")
|
@@ -30,4 +31,19 @@ tokens = model.generate(
|
|
30 |
do_sample=True,
|
31 |
stopping_criteria=StoppingCriteriaList([StopOnTokens()])
|
32 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
|
|
|
1 |
import torch
|
2 |
+
import gradio as gr
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer, StoppingCriteria, StoppingCriteriaList
|
4 |
|
5 |
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-tuned-alpha-7b")
|
|
|
31 |
do_sample=True,
|
32 |
stopping_criteria=StoppingCriteriaList([StopOnTokens()])
|
33 |
)
|
34 |
+
with gr.Blocks() as demo:
|
35 |
+
|
36 |
+
gr.Markdown("## StableLM-Tuned-Alpha-7b Chat")
|
37 |
+
gr.HTML('''<center><a href="https://huggingface.co/spaces/stabilityai/stablelm-tuned-alpha-chat?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space to skip the queue and run in a private space</center>''')
|
38 |
+
chatbot = gr.Chatbot().style(height=500)
|
39 |
+
with gr.Row():
|
40 |
+
with gr.Column(scale=0.70):
|
41 |
+
msg = gr.Textbox(label="Chat Message Box", placeholder="Chat Message Box", show_label=False).style(container=False)
|
42 |
+
with gr.Column(scale=0.30):
|
43 |
+
with gr.Row():
|
44 |
+
submit = gr.Button("Submit")
|
45 |
+
clear = gr.Button("Clear")
|
46 |
+
system_msg = gr.Textbox(
|
47 |
+
start_message, label="System Message", interactive=False, visible=False)
|
48 |
+
|
49 |
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
|