Xolkin commited on
Commit
834e3d1
·
verified ·
1 Parent(s): f82dc53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
  """
5
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
@@ -34,28 +34,31 @@ def respond(
34
  top_p=top_p,
35
  ):
36
  token = message.choices[0].delta.content
37
-
38
  response += token
39
  yield response
40
 
 
 
 
 
41
  """
42
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
43
  """
44
  demo = gr.ChatInterface(
45
  respond,
46
  additional_inputs=[
47
  gr.Textbox(
48
  value="Привет! Я помощник врача в больнице EMS штата Alta! Напиши внизу симптомы заболевания и я поставлю предварительный диагноз! И хирургическую операцию, если надо будет ее провести.",
49
- label="System message"
50
  ),
51
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
52
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
53
  gr.Slider(
54
  minimum=0.1,
55
  maximum=1.0,
56
  value=0.95,
57
  step=0.05,
58
- label="Top-p (nucleus sampling)",
59
  ),
60
  ],
61
  )
 
2
  from huggingface_hub import InferenceClient
3
 
4
  """
5
+ Для получения дополнительной информации об API Inference `huggingface_hub` ознакомьтесь с документацией: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
 
34
  top_p=top_p,
35
  ):
36
  token = message.choices[0].delta.content
 
37
  response += token
38
  yield response
39
 
40
+ # Добавляем идентификационное сообщение к ответу
41
+ final_response = f"{response}\n\nПривет! Я помощник врача в больнице EMS штата Alta!"
42
+ yield final_response
43
+
44
  """
45
+ Для получения информации о том, как настроить интерфейс чата, ознакомьтесь с документацией Gradio: https://www.gradio.app/docs/chatinterface
46
  """
47
  demo = gr.ChatInterface(
48
  respond,
49
  additional_inputs=[
50
  gr.Textbox(
51
  value="Привет! Я помощник врача в больнице EMS штата Alta! Напиши внизу симптомы заболевания и я поставлю предварительный диагноз! И хирургическую операцию, если надо будет ее провести.",
52
+ label="Системное сообщение"
53
  ),
54
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Максимальное количество новых токенов"),
55
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Температура"),
56
  gr.Slider(
57
  minimum=0.1,
58
  maximum=1.0,
59
  value=0.95,
60
  step=0.05,
61
+ label="Top-p (ядерное семплирование)",
62
  ),
63
  ],
64
  )