update predict funtcion
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
|
|
3 |
|
4 |
API_URL = "https://joi-20b.ngrok.io/generate_stream"
|
5 |
|
6 |
-
def predict(inputs,
|
7 |
if not inputs.startswith("User: "):
|
8 |
inputs = "User: " + inputs + "\n"
|
9 |
payload = {
|
@@ -12,12 +12,11 @@ def predict(inputs, history=[], top_p, temperature, top_k, repetition_penalty):
|
|
12 |
"details": True,
|
13 |
"do_sample": True,
|
14 |
"max_new_tokens": 20,
|
15 |
-
"repetition_penalty": 1.03,
|
16 |
"seed": 0,
|
17 |
-
"
|
18 |
-
"
|
19 |
-
"
|
20 |
-
"top_p": 0.95
|
21 |
}
|
22 |
}
|
23 |
|
@@ -73,8 +72,8 @@ with gr.Blocks(css = "#chatbot {height: 400px, overflow: auto;}") as demo:
|
|
73 |
|
74 |
#b1.click(predict, [t,s], [c,s])
|
75 |
#inputs.submit(predict, [t,s], [c,s])
|
76 |
-
inputs.submit( inference_chat, [inputs,
|
77 |
-
b1.click( inference_chat, [inputs,
|
78 |
|
79 |
gr.HTML(description)
|
80 |
demo.queue().launch(debug=True)
|
|
|
3 |
|
4 |
API_URL = "https://joi-20b.ngrok.io/generate_stream"
|
5 |
|
6 |
+
def predict(inputs, top_p, temperature, top_k, repetition_penalty, history=[]):
|
7 |
if not inputs.startswith("User: "):
|
8 |
inputs = "User: " + inputs + "\n"
|
9 |
payload = {
|
|
|
12 |
"details": True,
|
13 |
"do_sample": True,
|
14 |
"max_new_tokens": 20,
|
15 |
+
"repetition_penalty": repetition_penalty, #1.03,
|
16 |
"seed": 0,
|
17 |
+
"temperature": temperature, #0.5,
|
18 |
+
"top_k": top_k, #10,
|
19 |
+
"top_p": top_p #0.95
|
|
|
20 |
}
|
21 |
}
|
22 |
|
|
|
72 |
|
73 |
#b1.click(predict, [t,s], [c,s])
|
74 |
#inputs.submit(predict, [t,s], [c,s])
|
75 |
+
inputs.submit( inference_chat, [inputs, top_p, temperature, top_k, repetition_penalty, state], [chatbot, state],)
|
76 |
+
b1.click( inference_chat, [inputs, top_p, temperature, top_k, repetition_penalty, state], [chatbot, state],)
|
77 |
|
78 |
gr.HTML(description)
|
79 |
demo.queue().launch(debug=True)
|