Futuresony commited on
Commit
f3046d5
·
verified ·
1 Parent(s): e4dce1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -20,21 +20,13 @@ def fetch_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": 700, # 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)
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
40
  port = int(os.getenv("PORT", 7860))
 
20
  if not message:
21
  return jsonify({"error": "No input provided."}), 400
22
 
23
+
 
 
 
 
 
 
24
 
25
  # Process the message using the Hugging Face model
26
  try:
27
  response = client.text_generation(message)
28
  return jsonify({"response": response})
29
+
 
 
30
  if __name__ == "__main__":
31
  # Use PORT environment variable or default to 7860
32
  port = int(os.getenv("PORT", 7860))