Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,11 @@
|
|
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("CosmosRP-8k")
|
8 |
|
9 |
-
|
10 |
def respond(
|
11 |
message,
|
12 |
-
history
|
13 |
system_message,
|
14 |
max_tokens,
|
15 |
temperature,
|
@@ -39,11 +35,17 @@ 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=[
|
48 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
49 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
@@ -58,6 +60,5 @@ demo = gr.ChatInterface(
|
|
58 |
],
|
59 |
)
|
60 |
|
61 |
-
|
62 |
if __name__ == "__main__":
|
63 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
|
|
|
|
|
|
4 |
client = InferenceClient("CosmosRP-8k")
|
5 |
|
|
|
6 |
def respond(
|
7 |
message,
|
8 |
+
history,
|
9 |
system_message,
|
10 |
max_tokens,
|
11 |
temperature,
|
|
|
35 |
response += token
|
36 |
yield response
|
37 |
|
|
|
|
|
|
|
38 |
demo = gr.ChatInterface(
|
39 |
+
fn=respond,
|
40 |
+
inputs=[
|
41 |
+
"text",
|
42 |
+
"state",
|
43 |
+
"text",
|
44 |
+
"number",
|
45 |
+
"number",
|
46 |
+
"number",
|
47 |
+
],
|
48 |
+
outputs="text",
|
49 |
additional_inputs=[
|
50 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
51 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
|
|
60 |
],
|
61 |
)
|
62 |
|
|
|
63 |
if __name__ == "__main__":
|
64 |
demo.launch()
|