MatteoScript commited on
Commit
0e6616c
·
1 Parent(s): 4c7e9ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
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
- prompt = "<s>"
8
- with open('Manuale.txt', 'r') as file:
9
- manual_content = file.read()
10
- prompt += f"Leggi questo manuale dopo ti farò delle domande: {manual_content}"
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] {message} P.S. Ripondi come se fossi Zucchetti AI, l'assitente AI di Zucchetti e... inserisci una soluzione alla volta! [/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,10 +47,12 @@ mychatbot = gr.Chatbot(
47
  demo = gr.ChatInterface(fn=generate,
48
  chatbot=mychatbot,
49
  title="Zucchetti AI",
50
- retry_btn=None,
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)