Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,8 @@
|
|
| 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
|
| 6 |
-
"""
|
| 7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
|
| 9 |
-
|
| 10 |
def respond(
|
| 11 |
message,
|
| 12 |
history: list[tuple[str, str]],
|
|
@@ -35,18 +31,14 @@ def respond(
|
|
| 35 |
top_p=top_p,
|
| 36 |
):
|
| 37 |
token = message.choices[0].delta.content
|
| 38 |
-
|
| 39 |
response += token
|
| 40 |
yield response
|
| 41 |
|
| 42 |
-
|
| 43 |
-
"""
|
| 44 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 45 |
-
"""
|
| 46 |
demo = gr.ChatInterface(
|
| 47 |
respond,
|
| 48 |
additional_inputs=[
|
| 49 |
-
gr.Textbox(value="You are a
|
| 50 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 51 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 52 |
gr.Slider(
|
|
@@ -59,6 +51,6 @@ demo = gr.ChatInterface(
|
|
| 59 |
],
|
| 60 |
)
|
| 61 |
|
| 62 |
-
|
| 63 |
if __name__ == "__main__":
|
| 64 |
demo.launch()
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 5 |
|
|
|
|
| 6 |
def respond(
|
| 7 |
message,
|
| 8 |
history: list[tuple[str, str]],
|
|
|
|
| 31 |
top_p=top_p,
|
| 32 |
):
|
| 33 |
token = message.choices[0].delta.content
|
|
|
|
| 34 |
response += token
|
| 35 |
yield response
|
| 36 |
|
| 37 |
+
# Customized system message for 'Jesse'
|
|
|
|
|
|
|
|
|
|
| 38 |
demo = gr.ChatInterface(
|
| 39 |
respond,
|
| 40 |
additional_inputs=[
|
| 41 |
+
gr.Textbox(value="You are Jesse, a CompTIA certified Network+ Genius. You are knowledgeable in all things networking and provide expert advice.", label="System message"),
|
| 42 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 43 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 44 |
gr.Slider(
|
|
|
|
| 51 |
],
|
| 52 |
)
|
| 53 |
|
|
|
|
| 54 |
if __name__ == "__main__":
|
| 55 |
demo.launch()
|
| 56 |
+
|