Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
from sentence_transformers import SentenceTransformer
|
@@ -52,7 +61,7 @@ def respond(message, history):
|
|
52 |
"role": "system",
|
53 |
"content": (
|
54 |
"You are a chatbot that helps users create characters for role-playing games. "
|
55 |
-
"Use the following knowledge to inform your answers:\n\n" + context
|
56 |
)
|
57 |
}
|
58 |
]
|
@@ -64,7 +73,7 @@ def respond(message, history):
|
|
64 |
|
65 |
stream = client.chat_completion(
|
66 |
messages,
|
67 |
-
max_tokens=
|
68 |
temperature=1.2,
|
69 |
stream=True
|
70 |
)
|
|
|
1 |
+
chatbot = gr.ChatInterface(
|
2 |
+
magicEight,
|
3 |
+
type="messages",
|
4 |
+
examples=None,
|
5 |
+
title="Character Creator",
|
6 |
+
description="Welcome! Tell me what you want to create and we can make your character come to life!"
|
7 |
+
)
|
8 |
+
|
9 |
+
|
10 |
import gradio as gr
|
11 |
from huggingface_hub import InferenceClient
|
12 |
from sentence_transformers import SentenceTransformer
|
|
|
61 |
"role": "system",
|
62 |
"content": (
|
63 |
"You are a chatbot that helps users create characters for role-playing games. "
|
64 |
+
"Use the following knowledge to inform your answers:\n\n" + context + "and keep your answers under 300 words."
|
65 |
)
|
66 |
}
|
67 |
]
|
|
|
73 |
|
74 |
stream = client.chat_completion(
|
75 |
messages,
|
76 |
+
max_tokens=300,
|
77 |
temperature=1.2,
|
78 |
stream=True
|
79 |
)
|