Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,14 @@ def fetch_message():
|
|
20 |
if not message:
|
21 |
return jsonify({"error": "No input provided."}), 400
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
# Process the message using the Hugging Face model
|
24 |
try:
|
25 |
response = client.text_generation(message)
|
|
|
20 |
if not message:
|
21 |
return jsonify({"error": "No input provided."}), 400
|
22 |
|
23 |
+
# Set parameters for text generation
|
24 |
+
generation_params = {
|
25 |
+
"temperature": 0.7, # Adjust creativity level
|
26 |
+
"top_p": 0.9, # Use nucleus sampling
|
27 |
+
"max_new_tokens": 150, # Limit the response length
|
28 |
+
"repetition_penalty": 1.1 # Avoid repeating text
|
29 |
+
}
|
30 |
+
|
31 |
# Process the message using the Hugging Face model
|
32 |
try:
|
33 |
response = client.text_generation(message)
|