Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,11 +7,17 @@ def generate_text(input_text, history):
|
|
| 7 |
# Initialize the pipeline with specified parameters
|
| 8 |
pipe = pipeline("text-generation", model="ngxson/MiniThinky-v2-1B-Llama-3.2", max_new_tokens=1024, temperature=0.7, do_sample=True)
|
| 9 |
|
| 10 |
-
# Prepare the
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Generate response
|
| 14 |
-
response = pipe(messages)
|
| 15 |
|
| 16 |
# Extract the generated text
|
| 17 |
response_text = response[0]["generated_text"]
|
|
|
|
| 7 |
# Initialize the pipeline with specified parameters
|
| 8 |
pipe = pipeline("text-generation", model="ngxson/MiniThinky-v2-1B-Llama-3.2", max_new_tokens=1024, temperature=0.7, do_sample=True)
|
| 9 |
|
| 10 |
+
# Prepare the system message
|
| 11 |
+
system_message = "You are MiniThinky, a helpful AI assistant. You always think before giving the answer. Use <|thinking|> before thinking and <|answer|> before giving the answer."
|
| 12 |
+
|
| 13 |
+
# Format the input messages
|
| 14 |
+
messages = [
|
| 15 |
+
{"role": "system", "content": system_message},
|
| 16 |
+
{"role": "user", "content": input_text}
|
| 17 |
+
]
|
| 18 |
|
| 19 |
# Generate response
|
| 20 |
+
response = pipe(messages, max_new_tokens=1024, temperature=0.7, do_sample=True)
|
| 21 |
|
| 22 |
# Extract the generated text
|
| 23 |
response_text = response[0]["generated_text"]
|