Spaces:
Sleeping
Sleeping
Bertrand Cabot
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|
| 9 |
|
|
@@ -39,9 +44,9 @@ def respond(
|
|
| 39 |
response += token
|
| 40 |
yield response
|
| 41 |
|
| 42 |
-
|
| 43 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 44 |
-
|
| 45 |
demo = gr.ChatInterface(
|
| 46 |
respond,
|
| 47 |
additional_inputs=[
|
|
@@ -57,7 +62,7 @@ demo = gr.ChatInterface(
|
|
| 57 |
),
|
| 58 |
],
|
| 59 |
)
|
| 60 |
-
|
| 61 |
|
| 62 |
if __name__ == "__main__":
|
| 63 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import random
|
| 3 |
+
|
| 4 |
+
def random_response(message, history):
|
| 5 |
+
return random.choice(["Yes", "No"])
|
| 6 |
+
|
| 7 |
+
demo = gr.ChatInterface(random_response)
|
| 8 |
|
| 9 |
"""
|
| 10 |
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
|
| 11 |
+
|
| 12 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 13 |
|
| 14 |
|
|
|
|
| 44 |
response += token
|
| 45 |
yield response
|
| 46 |
|
| 47 |
+
|
| 48 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 49 |
+
|
| 50 |
demo = gr.ChatInterface(
|
| 51 |
respond,
|
| 52 |
additional_inputs=[
|
|
|
|
| 62 |
),
|
| 63 |
],
|
| 64 |
)
|
| 65 |
+
"""
|
| 66 |
|
| 67 |
if __name__ == "__main__":
|
| 68 |
demo.launch()
|