AshenClock commited on
Commit
59a476c
·
verified ·
1 Parent(s): aa07e9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -60,16 +60,14 @@ def generate_response(message, max_tokens, temperature):
60
  full_prompt = f"{system_message}\nUtente: {message}\nAssistente:"
61
 
62
  try:
63
- # Usa il metodo corretto per invocare il modello Hugging Face
64
- response = client.post(
65
  model="Qwen/Qwen2.5-72B-Instruct",
66
  inputs=full_prompt,
67
- parameters={
68
- "max_new_tokens": max_tokens,
69
- "temperature": temperature
70
- }
71
  )
72
- return response.get("generated_text", "").strip()
73
  except Exception as e:
74
  raise HTTPException(status_code=500, detail=f"Errore nell'elaborazione: {str(e)}")
75
 
 
60
  full_prompt = f"{system_message}\nUtente: {message}\nAssistente:"
61
 
62
  try:
63
+ # Usa il metodo text_generation per invocare il modello Hugging Face
64
+ response = client.text_generation(
65
  model="Qwen/Qwen2.5-72B-Instruct",
66
  inputs=full_prompt,
67
+ max_new_tokens=max_tokens,
68
+ temperature=temperature
 
 
69
  )
70
+ return response.strip()
71
  except Exception as e:
72
  raise HTTPException(status_code=500, detail=f"Errore nell'elaborazione: {str(e)}")
73