Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,20 +3,8 @@ from huggingface_hub import InferenceClient
|
|
3 |
import requests
|
4 |
import os
|
5 |
|
6 |
-
url = "http://
|
7 |
|
8 |
-
"""
|
9 |
-
class ChatRequest(BaseModel):
|
10 |
-
messages: typing.List[typing.Dict]
|
11 |
-
max_new_tokens: int
|
12 |
-
max_length: int = 4096
|
13 |
-
temperature: int = 1.0
|
14 |
-
top_k: int = 0
|
15 |
-
top_p: float = 1.0
|
16 |
-
repetition_penalty: float = 1.03
|
17 |
-
do_sample: bool = True
|
18 |
-
seed: int = 42
|
19 |
-
"""
|
20 |
|
21 |
def respond(
|
22 |
message,
|
@@ -60,13 +48,15 @@ def respond(
|
|
60 |
"""
|
61 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
62 |
"""
|
|
|
63 |
demo = gr.ChatInterface(
|
64 |
respond,
|
|
|
65 |
additional_inputs=[
|
66 |
# gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
67 |
gr.Checkbox(True, label="do sample"),
|
68 |
gr.Number(42, precision=0, label="seed"),
|
69 |
-
gr.Slider(minimum=1, maximum=2048, value=
|
70 |
gr.Slider(minimum=0.01, maximum=4.0, value=0.7, step=0.01, label="Temperature"),
|
71 |
gr.Slider(
|
72 |
minimum=0.1,
|
@@ -94,5 +84,5 @@ demo = gr.ChatInterface(
|
|
94 |
|
95 |
|
96 |
if __name__ == "__main__":
|
97 |
-
demo.queue(default_concurrency_limit=
|
98 |
demo.launch()
|
|
|
3 |
import requests
|
4 |
import os
|
5 |
|
6 |
+
url = "http://59.110.170.104:8085/chat_completion"
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def respond(
|
10 |
message,
|
|
|
48 |
"""
|
49 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
50 |
"""
|
51 |
+
|
52 |
demo = gr.ChatInterface(
|
53 |
respond,
|
54 |
+
chatbot=gr.Chatbot(height=600),
|
55 |
additional_inputs=[
|
56 |
# gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
57 |
gr.Checkbox(True, label="do sample"),
|
58 |
gr.Number(42, precision=0, label="seed"),
|
59 |
+
gr.Slider(minimum=1, maximum=2048, value=1024, step=1, label="Max new tokens"),
|
60 |
gr.Slider(minimum=0.01, maximum=4.0, value=0.7, step=0.01, label="Temperature"),
|
61 |
gr.Slider(
|
62 |
minimum=0.1,
|
|
|
84 |
|
85 |
|
86 |
if __name__ == "__main__":
|
87 |
+
demo.queue(default_concurrency_limit=2, max_size=10)
|
88 |
demo.launch()
|