AndreaAlessandrelli4 commited on
Commit
c422365
·
verified ·
1 Parent(s): a654656

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -73,11 +73,10 @@ def generate(
73
  chat_history: list[tuple[str, str]],
74
  #system_prompt: str,
75
  max_new_tokens: int = 1024,
76
- do_sample: bool = False,
77
- #temperature: float = 0.1,
78
- #top_p: float = 0.9,
79
- #top_k: int = 50,
80
- #repetition_penalty: float = 1.2,
81
  ) -> Iterator[str]:
82
  model1 = SentenceTransformer('intfloat/multilingual-e5-large')
83
  embeddings_query = model1.encode('query: '+str(message), normalize_embeddings=True)
@@ -105,12 +104,11 @@ def generate(
105
  {"input_ids": input_ids},
106
  streamer=streamer,
107
  max_new_tokens=max_new_tokens,
108
- do_sample=False,
109
- #top_p=top_p,
110
- #top_k=top_k,
111
- #temperature=temperature,
112
- #num_beams=1,
113
- #repetition_penalty=repetition_penalty,
114
  )
115
  t = Thread(target=model.generate, kwargs=generate_kwargs)
116
  t.start()
@@ -145,7 +143,7 @@ with gr.Blocks(css="style.css") as demo:
145
  gr.Markdown("# AvvoChat")
146
  gr.Markdown("Fai una domanda riguardante la legge italiana all'AvvoChat e ricevi una spiegazione semplice al tuo dubbio.")
147
  with gr.Row():
148
- with gr.Column(scale=0.5, min_width = 100):
149
  gr.Image("AvvoVhat.png", width = 50, height=200,
150
  show_label=False, show_share_button=False, show_download_button=False, container=False),
151
  with gr.Column(scale=6):
 
73
  chat_history: list[tuple[str, str]],
74
  #system_prompt: str,
75
  max_new_tokens: int = 1024,
76
+ temperature: float = 0.1,
77
+ top_p: float = 0.9,
78
+ top_k: int = 50,
79
+ repetition_penalty: float = 1.2,
 
80
  ) -> Iterator[str]:
81
  model1 = SentenceTransformer('intfloat/multilingual-e5-large')
82
  embeddings_query = model1.encode('query: '+str(message), normalize_embeddings=True)
 
104
  {"input_ids": input_ids},
105
  streamer=streamer,
106
  max_new_tokens=max_new_tokens,
107
+ top_p=top_p,
108
+ top_k=top_k,
109
+ temperature=temperature,
110
+ num_beams=1,
111
+ repetition_penalty=repetition_penalty,
 
112
  )
113
  t = Thread(target=model.generate, kwargs=generate_kwargs)
114
  t.start()
 
143
  gr.Markdown("# AvvoChat")
144
  gr.Markdown("Fai una domanda riguardante la legge italiana all'AvvoChat e ricevi una spiegazione semplice al tuo dubbio.")
145
  with gr.Row():
146
+ with gr.Column(scale=1, min_width = 100):
147
  gr.Image("AvvoVhat.png", width = 50, height=200,
148
  show_label=False, show_share_button=False, show_download_button=False, container=False),
149
  with gr.Column(scale=6):