Update app.py
Browse files
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
|
| 64 |
-
response = client.
|
| 65 |
model="Qwen/Qwen2.5-72B-Instruct",
|
| 66 |
inputs=full_prompt,
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
"temperature": temperature
|
| 70 |
-
}
|
| 71 |
)
|
| 72 |
-
return response.
|
| 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 |
|