Spaces:
Runtime error
Runtime error
Commit
•
082fbfd
1
Parent(s):
072a08d
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ generator = ctranslate2.Generator("./FixedStar-BETA-7b-ct2", device=device)
|
|
23 |
tokenizer = AutoTokenizer.from_pretrained(
|
24 |
"./tokenizer", use_fast=True)
|
25 |
|
26 |
-
def inference_func(prompt, max_length=
|
27 |
tokens = tokenizer.convert_ids_to_tokens(
|
28 |
tokenizer.encode(prompt, add_special_tokens=False)
|
29 |
)
|
@@ -63,13 +63,11 @@ def interact_func(message, chat_history, max_context_size, max_length, sampling_
|
|
63 |
chat_history.append((message, generated))
|
64 |
return "", chat_history
|
65 |
|
66 |
-
gr.
|
67 |
-
|
68 |
-
with gr.Blocks(theme="monochrome", css="style.css") as demo:
|
69 |
with gr.Accordion("Configs", open=False):
|
70 |
# max_context_size = the number of turns * 2
|
71 |
max_context_size = gr.Number(value=20, label="記憶する会話ターン数", precision=0)
|
72 |
-
max_length = gr.Number(value=
|
73 |
sampling_temperature = gr.Slider(0.0, 2.0, value=0.7, step=0.1, label="創造性")
|
74 |
chatbot = gr.Chatbot()
|
75 |
msg = gr.Textbox()
|
@@ -81,5 +79,7 @@ with gr.Blocks(theme="monochrome", css="style.css") as demo:
|
|
81 |
)
|
82 |
clear.click(lambda: None, None, chatbot, queue=False)
|
83 |
|
|
|
|
|
84 |
if __name__ == "__main__":
|
85 |
demo.launch(debug=True, share=True)
|
|
|
23 |
tokenizer = AutoTokenizer.from_pretrained(
|
24 |
"./tokenizer", use_fast=True)
|
25 |
|
26 |
+
def inference_func(prompt, max_length=64, sampling_temperature=0.7):
|
27 |
tokens = tokenizer.convert_ids_to_tokens(
|
28 |
tokenizer.encode(prompt, add_special_tokens=False)
|
29 |
)
|
|
|
63 |
chat_history.append((message, generated))
|
64 |
return "", chat_history
|
65 |
|
66 |
+
with gr.Blocks(theme="monochrome") as demo:
|
|
|
|
|
67 |
with gr.Accordion("Configs", open=False):
|
68 |
# max_context_size = the number of turns * 2
|
69 |
max_context_size = gr.Number(value=20, label="記憶する会話ターン数", precision=0)
|
70 |
+
max_length = gr.Number(value=64, label="最大文字数", precision=0)
|
71 |
sampling_temperature = gr.Slider(0.0, 2.0, value=0.7, step=0.1, label="創造性")
|
72 |
chatbot = gr.Chatbot()
|
73 |
msg = gr.Textbox()
|
|
|
79 |
)
|
80 |
clear.click(lambda: None, None, chatbot, queue=False)
|
81 |
|
82 |
+
gr.Markdown(DESCRIPTION)
|
83 |
+
|
84 |
if __name__ == "__main__":
|
85 |
demo.launch(debug=True, share=True)
|