Aggiorna app.py
Browse files123456710 unmodified lines18192021222324252627282930import gradio as grfrom huggingface_hub import InferenceClientclient = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2")SYSTEM_PROMPT = """Tu sei Neurino, un assistente caldo, empatico, elegante e luminoso,10 unmodified linesdef chat_fn(message, history, corpus):prompt = f"{SYSTEM_PROMPT}\n\nCORPUS:\n{corpus}\n\nDOMANDA:\n{message}\n\nRISPOSTA:"response = client.text_generation(prompt,max_new_tokens=300,temperature=0.6,top_p=0.9,)return responsewith gr.Blocks(title="Neurino") as demo:gr.Markdown("<h1 style='text-align:center;'>✨ Neurino — BrainBook Assistant ✨</h1>")123456710 unmodified lines18192021222324252627282930313233343536import gradio as grfrom huggingface_hub import InferenceClientclient = InferenceClient("HuggingFaceH4/zephyr-7b-beta")SYSTEM_PROMPT = """Tu sei Neurino, un assistente caldo, empatico, elegante e luminoso,10 unmodified linesdef chat_fn(message, history, corpus):prompt = f"{SYSTEM_PROMPT}\n\nCORPUS:\n{corpus}\n\nDOMANDA:\n{message}\n\nRISPOSTA:"response = client.post(json={"inputs": prompt,"parameters": {"max_new_tokens": 200,"temperature": 0.7,"top_p": 0.9}})return response["generated_text"]with gr.Blocks(title="Neurino") as demo:gr.Markdown("<h1 style='text-align:center;'>✨ Neurino — BrainBook Assistant ✨</h1>")
app.py+13-7