Spaces:
Runtime error
Runtime error
shifted indentation again
Browse files
app.py
CHANGED
|
@@ -8,22 +8,22 @@ client = InferenceClient("google/gemma-3-27b-it")
|
|
| 8 |
def respond(message,history):
|
| 9 |
messages = [{"role": "system", "content": "You are a mean chatbot."}]
|
| 10 |
|
| 11 |
-
if history:
|
| 12 |
-
|
| 13 |
-
|
| 14 |
message.append({"role": "user", "content": message})
|
| 15 |
-
|
| 16 |
response = ""
|
| 17 |
-
|
| 18 |
for message in client.chat_completion(
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
#temperature=.9,
|
| 28 |
#top_p=.7) #changes the length of message
|
| 29 |
|
|
|
|
| 8 |
def respond(message,history):
|
| 9 |
messages = [{"role": "system", "content": "You are a mean chatbot."}]
|
| 10 |
|
| 11 |
+
if history:
|
| 12 |
+
messages.extend(history)
|
| 13 |
+
|
| 14 |
message.append({"role": "user", "content": message})
|
| 15 |
+
|
| 16 |
response = ""
|
| 17 |
+
|
| 18 |
for message in client.chat_completion(
|
| 19 |
+
messages,
|
| 20 |
+
max_tokens=50,
|
| 21 |
+
stream=True
|
| 22 |
+
):
|
| 23 |
+
token = message.choices[0].delta.content
|
| 24 |
+
response += token
|
| 25 |
+
yield response
|
| 26 |
+
|
| 27 |
#temperature=.9,
|
| 28 |
#top_p=.7) #changes the length of message
|
| 29 |
|