Spaces:
Sleeping
Sleeping
Update app.py
Browse files7 unmodified lines89101112131410 unmodified lines25262728293031323334353637383940417 unmodified linesHF_TOKEN = os.getenv("HF_TOKEN")client = InferenceClient(model="mistralai/Mistral-7B-Instruct-v0.2",token=HF_TOKEN)10 unmodified linesreturn PlainTextResponse("Пустое сообщение")try:response = client.chat_completion(messages=[{"role": "system", "content": "Answer briefly and clearly."},{"role": "user", "content": message}],max_tokens=100,temperature=0.7)answer = response.choices[0].message.contentreturn PlainTextResponse(answer.strip())except Exception as e:return PlainTextResponse(f"ERROR: {str(e)}")7 unmodified lines89101112131410 unmodified lines2526272829303132333435367 unmodified linesHF_TOKEN = os.getenv("HF_TOKEN")client = InferenceClient(model="google/flan-t5-small",token=HF_TOKEN)10 unmodified linesreturn PlainTextResponse("Пустое сообщение")try:response = client.text_generation(f"Answer briefly: {message}",max_new_tokens=100)return PlainTextResponse(response.strip())except Exception as e:return PlainTextResponse(f"ERROR: {str(e)}")
app.py+5-10