Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ def fetch_message():
|
|
24 |
generation_params = {
|
25 |
"temperature": 0.7, # Adjust creativity level
|
26 |
"top_p": 0.9, # Use nucleus sampling
|
27 |
-
"max_new_tokens":
|
28 |
"repetition_penalty": 1.1 # Avoid repeating text
|
29 |
}
|
30 |
|
@@ -33,7 +33,7 @@ def fetch_message():
|
|
33 |
response = client.text_generation(message)
|
34 |
return jsonify({"response": response})
|
35 |
except Exception as e:
|
36 |
-
return jsonify({"error": str(e)}),
|
37 |
|
38 |
if __name__ == "__main__":
|
39 |
# Use PORT environment variable or default to 7860
|
|
|
24 |
generation_params = {
|
25 |
"temperature": 0.7, # Adjust creativity level
|
26 |
"top_p": 0.9, # Use nucleus sampling
|
27 |
+
"max_new_tokens": 700, # Limit the response length
|
28 |
"repetition_penalty": 1.1 # Avoid repeating text
|
29 |
}
|
30 |
|
|
|
33 |
response = client.text_generation(message)
|
34 |
return jsonify({"response": response})
|
35 |
except Exception as e:
|
36 |
+
return jsonify({"error": str(e)}), 1000
|
37 |
|
38 |
if __name__ == "__main__":
|
39 |
# Use PORT environment variable or default to 7860
|