codeblacks commited on
Commit
6ca4d07
·
verified ·
1 Parent(s): 5e016ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,5 +1,7 @@
1
  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
@@ -7,7 +9,7 @@ For more information on `huggingface_hub` Inference API support, please check th
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
9
 
10
- def respond(
11
  message,
12
  history: list[tuple[str, str]],
13
  system_message,
@@ -27,7 +29,7 @@ def respond(
27
 
28
  response = ""
29
 
30
- for message in client.chat_completion(
31
  messages,
32
  max_tokens=max_tokens,
33
  stream=True,
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
+ import asyncio
4
+
5
 
6
  """
7
  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
 
9
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
10
 
11
 
12
+ async def respond(
13
  message,
14
  history: list[tuple[str, str]],
15
  system_message,
 
29
 
30
  response = ""
31
 
32
+ async for message in client.chat_completion(
33
  messages,
34
  max_tokens=max_tokens,
35
  stream=True,