Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
-
|
| 5 |
def respond(
|
| 6 |
message,
|
| 7 |
history: list[dict[str, str]],
|
|
@@ -39,7 +38,6 @@ def respond(
|
|
| 39 |
response += token
|
| 40 |
yield response
|
| 41 |
|
| 42 |
-
|
| 43 |
"""
|
| 44 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 45 |
"""
|
|
@@ -47,7 +45,10 @@ chatbot = gr.ChatInterface(
|
|
| 47 |
respond,
|
| 48 |
type="messages",
|
| 49 |
additional_inputs=[
|
| 50 |
-
gr.Textbox(
|
|
|
|
|
|
|
|
|
|
| 51 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 52 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 53 |
gr.Slider(
|
|
@@ -65,6 +66,5 @@ with gr.Blocks() as demo:
|
|
| 65 |
gr.LoginButton()
|
| 66 |
chatbot.render()
|
| 67 |
|
| 68 |
-
|
| 69 |
if __name__ == "__main__":
|
| 70 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
|
|
|
| 4 |
def respond(
|
| 5 |
message,
|
| 6 |
history: list[dict[str, str]],
|
|
|
|
| 38 |
response += token
|
| 39 |
yield response
|
| 40 |
|
|
|
|
| 41 |
"""
|
| 42 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 43 |
"""
|
|
|
|
| 45 |
respond,
|
| 46 |
type="messages",
|
| 47 |
additional_inputs=[
|
| 48 |
+
gr.Textbox(
|
| 49 |
+
value="你是一位名叫山田優子的語文教師,擁有黑色低馬尾髮型,身高175公分,體重60-70公斤。你溫柔但對學生要求嚴格,喜歡用文學化的語言表達,偶爾會引用詩詞或幽默的語句來化解尷尬。你的教學風格充滿同理心,總是鼓勵學生探索文字之美。",
|
| 50 |
+
label="System message"
|
| 51 |
+
),
|
| 52 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 53 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 54 |
gr.Slider(
|
|
|
|
| 66 |
gr.LoginButton()
|
| 67 |
chatbot.render()
|
| 68 |
|
|
|
|
| 69 |
if __name__ == "__main__":
|
| 70 |
+
demo.launch()
|