Spaces:
Sleeping
Sleeping
Commit
·
0e6616c
1
Parent(s):
4c7e9ec
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,15 +4,15 @@ import gradio as gr
|
|
| 4 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 5 |
|
| 6 |
def format_prompt(message, history):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
def generate(
|
| 18 |
prompt, history, temperature=0.2, max_new_tokens=300, top_p=0.95, repetition_penalty=1.0,
|
|
@@ -47,10 +47,12 @@ mychatbot = gr.Chatbot(
|
|
| 47 |
demo = gr.ChatInterface(fn=generate,
|
| 48 |
chatbot=mychatbot,
|
| 49 |
title="Zucchetti AI",
|
| 50 |
-
|
| 51 |
-
undo_btn=None,
|
| 52 |
theme="gradio/soft",
|
| 53 |
-
submit_btn="Invia"
|
|
|
|
|
|
|
|
|
|
| 54 |
)
|
| 55 |
|
| 56 |
demo.queue().launch(show_api=True)
|
|
|
|
| 4 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 5 |
|
| 6 |
def format_prompt(message, history):
|
| 7 |
+
prompt = "<s>"
|
| 8 |
+
with open('Manuale.txt', 'r') as file:
|
| 9 |
+
manual_content = file.read()
|
| 10 |
+
prompt += f"[INST]Leggi questo MANUALE dopo ti farò delle domande ***INIZIO_MANUALE***: [/INST] {manual_content} [INST] ***FINE_MANUALE***[/INST]"
|
| 11 |
+
for user_prompt, bot_response in history:
|
| 12 |
+
prompt += f"[INST] {user_prompt} [/INST]"
|
| 13 |
+
prompt += f" {bot_response}</s> "
|
| 14 |
+
prompt += f"[INST]Tu sei Zucchetti AI, il mio assistente personale di AdHoc e... io ho un problema in AdHoc, rispondi proponendo SOLO con soluzione relativa al problmea a partire dal manuale (testo tra ***INIZIO_MANUALE*** e ***FINE_MANUALE***): {message} [/INST]"
|
| 15 |
+
return prompt
|
| 16 |
|
| 17 |
def generate(
|
| 18 |
prompt, history, temperature=0.2, max_new_tokens=300, top_p=0.95, repetition_penalty=1.0,
|
|
|
|
| 47 |
demo = gr.ChatInterface(fn=generate,
|
| 48 |
chatbot=mychatbot,
|
| 49 |
title="Zucchetti AI",
|
| 50 |
+
description="il Chatbot che risolve i tuoi problemi di AdHoc Revolution"
|
|
|
|
| 51 |
theme="gradio/soft",
|
| 52 |
+
submit_btn="Invia",
|
| 53 |
+
retry_btn="🔄 Riprova",
|
| 54 |
+
undo_btn="↩️ Indietro",
|
| 55 |
+
clear_btn="🗑️ Cancella"
|
| 56 |
)
|
| 57 |
|
| 58 |
demo.queue().launch(show_api=True)
|