Update app.py
Browse files
app.py
CHANGED
@@ -19,9 +19,6 @@ model = AutoModelForCausalLM.from_pretrained(model_id)
|
|
19 |
# Create a text generation pipeline
|
20 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
21 |
|
22 |
-
# Define the pre-prompt
|
23 |
-
PRE_PROMPT = "You are a helpful customer service assistant. Answer the customer's question clearl, with care and concisely."
|
24 |
-
|
25 |
# Define request body schema
|
26 |
class TextGenerationRequest(BaseModel):
|
27 |
prompt: str
|
@@ -37,12 +34,9 @@ async def generate_text(request: TextGenerationRequest):
|
|
37 |
try:
|
38 |
logger.info("Generating text...")
|
39 |
|
40 |
-
#
|
41 |
-
combined_input = f"{PRE_PROMPT} {request.prompt}"
|
42 |
-
|
43 |
-
# Generate text using the pipeline
|
44 |
outputs = pipe(
|
45 |
-
|
46 |
max_new_tokens=request.max_new_tokens,
|
47 |
temperature=request.temperature,
|
48 |
top_k=request.top_k,
|
|
|
19 |
# Create a text generation pipeline
|
20 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
21 |
|
|
|
|
|
|
|
22 |
# Define request body schema
|
23 |
class TextGenerationRequest(BaseModel):
|
24 |
prompt: str
|
|
|
34 |
try:
|
35 |
logger.info("Generating text...")
|
36 |
|
37 |
+
# Generate text using the pipeline with the user's prompt
|
|
|
|
|
|
|
38 |
outputs = pipe(
|
39 |
+
request.prompt, # Use the user's prompt directly
|
40 |
max_new_tokens=request.max_new_tokens,
|
41 |
temperature=request.temperature,
|
42 |
top_k=request.top_k,
|