Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
import spaces
|
|
@@ -8,9 +9,10 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
| 8 |
@spaces.GPU
|
| 9 |
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
def respond(
|
| 16 |
message,
|
|
@@ -19,6 +21,8 @@ def respond(
|
|
| 19 |
max_tokens,
|
| 20 |
temperature,
|
| 21 |
top_p,
|
|
|
|
|
|
|
| 22 |
):
|
| 23 |
messages = [{"role": "system", "content": system_message}]
|
| 24 |
|
|
@@ -48,6 +52,13 @@ def respond(
|
|
| 48 |
response += token
|
| 49 |
yield response
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
"""
|
| 52 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 53 |
"""
|
|
@@ -63,6 +74,7 @@ demo = gr.ChatInterface(
|
|
| 63 |
value=0.95,
|
| 64 |
step=0.05,
|
| 65 |
label="Top-p (nucleus sampling)",
|
|
|
|
| 66 |
|
| 67 |
),
|
| 68 |
],
|
|
|
|
| 1 |
+
from pyexpat.errors import messages
|
| 2 |
import gradio as gr
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
import spaces
|
|
|
|
| 9 |
@spaces.GPU
|
| 10 |
|
| 11 |
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
|
| 17 |
def respond(
|
| 18 |
message,
|
|
|
|
| 21 |
max_tokens,
|
| 22 |
temperature,
|
| 23 |
top_p,
|
| 24 |
+
show_copy_button=True,
|
| 25 |
+
|
| 26 |
):
|
| 27 |
messages = [{"role": "system", "content": system_message}]
|
| 28 |
|
|
|
|
| 52 |
response += token
|
| 53 |
yield response
|
| 54 |
|
| 55 |
+
if messages == "" :
|
| 56 |
+
raise gr.Error("votre message est vide ")
|
| 57 |
+
else : None
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
"""
|
| 63 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 64 |
"""
|
|
|
|
| 74 |
value=0.95,
|
| 75 |
step=0.05,
|
| 76 |
label="Top-p (nucleus sampling)",
|
| 77 |
+
show_copy_button = True
|
| 78 |
|
| 79 |
),
|
| 80 |
],
|