Spaces:
Runtime error
Runtime error
john
commited on
Commit
·
f38b63a
1
Parent(s):
3592be6
Update app.py
Browse files
app.py
CHANGED
@@ -11,18 +11,23 @@ theme = gr.themes.Soft(
|
|
11 |
neutral_hue="red",
|
12 |
)
|
13 |
title = """<h1 align="center">Chat with awesome WizardLM 7b model!</h1><br>"""
|
14 |
-
|
15 |
with gr.Blocks(theme=theme) as demo:
|
16 |
gr.HTML(title)
|
17 |
-
gr.HTML("This model is awesome for its size! It is only 20th the size of
|
18 |
chatbot = gr.Chatbot()
|
19 |
msg = gr.Textbox()
|
|
|
|
|
20 |
|
21 |
def user(user_message, history):
|
22 |
return gr.update(value="", interactive=True), history + [[user_message, None]]
|
23 |
|
24 |
def bot(history):
|
|
|
25 |
user_message = history[-1][0]
|
|
|
|
|
|
|
26 |
tokens3 = llm2.tokenize(user_message.encode())
|
27 |
token4 = llm2.tokenize(b"\n\n### Response:")
|
28 |
tokens = tokens3 + token4
|
@@ -42,6 +47,7 @@ with gr.Blocks(theme=theme) as demo:
|
|
42 |
bot, chatbot, chatbot
|
43 |
)
|
44 |
response.then(lambda: gr.update(interactive=True), None, [msg], queue=False)
|
|
|
45 |
|
46 |
demo.queue()
|
47 |
demo.launch(debug=True)
|
|
|
11 |
neutral_hue="red",
|
12 |
)
|
13 |
title = """<h1 align="center">Chat with awesome WizardLM 7b model!</h1><br>"""
|
|
|
14 |
with gr.Blocks(theme=theme) as demo:
|
15 |
gr.HTML(title)
|
16 |
+
gr.HTML("This model is awesome for its size! It is only 20th the size of Chatgpt but is around 90% as good as Chatgpt. However, please don't rely on WizardLM to provide 100% true information as it might be wrong sometimes. ")
|
17 |
chatbot = gr.Chatbot()
|
18 |
msg = gr.Textbox()
|
19 |
+
clear = gr.ClearButton([msg, chatbot])
|
20 |
+
#instruction = gr.Textbox(label="Instruction", placeholder=)
|
21 |
|
22 |
def user(user_message, history):
|
23 |
return gr.update(value="", interactive=True), history + [[user_message, None]]
|
24 |
|
25 |
def bot(history):
|
26 |
+
#instruction = history[-1][1] or ""
|
27 |
user_message = history[-1][0]
|
28 |
+
#token1 = llm.tokenize(b"### Instruction: ")
|
29 |
+
#token2 = llm.tokenize(instruction.encode())
|
30 |
+
#token3 = llm2.tokenize(b"USER: ")
|
31 |
tokens3 = llm2.tokenize(user_message.encode())
|
32 |
token4 = llm2.tokenize(b"\n\n### Response:")
|
33 |
tokens = tokens3 + token4
|
|
|
47 |
bot, chatbot, chatbot
|
48 |
)
|
49 |
response.then(lambda: gr.update(interactive=True), None, [msg], queue=False)
|
50 |
+
gr.HTML("Thanks for checking out this app!")
|
51 |
|
52 |
demo.queue()
|
53 |
demo.launch(debug=True)
|