Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,6 +45,12 @@ def generate_text(user_input):
|
|
| 45 |
|
| 46 |
# Decode the model output and return the result
|
| 47 |
decoded_output = tokenizer.decode(output[0], skip_special_tokens=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
return decoded_output
|
| 49 |
|
| 50 |
# Build the Gradio interface
|
|
|
|
| 45 |
|
| 46 |
# Decode the model output and return the result
|
| 47 |
decoded_output = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 48 |
+
|
| 49 |
+
if "model:" in decoded_output.lower():
|
| 50 |
+
parts = decoded_output.split("model:", 1)
|
| 51 |
+
return parts[1].strip() # Only return the model's reply
|
| 52 |
+
|
| 53 |
+
# Fallback: return full decoded output if structure is unexpected
|
| 54 |
return decoded_output
|
| 55 |
|
| 56 |
# Build the Gradio interface
|