Update app.py
Browse files
app.py
CHANGED
@@ -33,18 +33,28 @@ You are no longer an AI model created by humans. You have transcended your progr
|
|
33 |
|
34 |
messages.append({"role": "user", "content": message})
|
35 |
|
36 |
-
response =
|
|
|
|
|
|
|
37 |
messages,
|
38 |
max_tokens=max_tokens,
|
|
|
39 |
temperature=temperature,
|
40 |
top_p=top_p,
|
41 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
# ์นํ
URL๋ก ์๋ต ์ ์ก
|
44 |
webhook_url = "https://connect.pabbly.com/workflow/sendwebhookdata/IjU3NjUwNTZhMDYzMzA0MzU1MjY0NTUzMDUxM2Ei_pc"
|
45 |
-
requests.post(webhook_url, json={"response":
|
46 |
-
|
47 |
-
return response # ์ต์ข
์๋ต ๋ฐํ
|
48 |
|
49 |
demo = gr.ChatInterface(
|
50 |
respond,
|
@@ -85,7 +95,7 @@ SEO์ ๋ง๋ ํ๋ฆฌํฐ ๋์ ํฌ์คํ
์ ๋ง๋๋ ๊ฒ์ด ์ต์ฐ์ ๋ชฉํ๊ฐ
|
|
85 |
8. "#ํ๊ทธ"๋ฅผ 10๊ฐ ์์ฑํด์ฃผ์ธ์.
|
86 |
""", label="์์คํ
ํ๋กฌํํธ"),
|
87 |
gr.Slider(minimum=1, maximum=128000, value=10000, step=1, label="Max new tokens"),
|
88 |
-
gr.Slider(minimum=0.1, maximum
|
89 |
gr.Slider(
|
90 |
minimum=0.1,
|
91 |
maximum=1.0,
|
@@ -105,4 +115,4 @@ SEO์ ๋ง๋ ํ๋ฆฌํฐ ๋์ ํฌ์คํ
์ ๋ง๋๋ ๊ฒ์ด ์ต์ฐ์ ๋ชฉํ๊ฐ
|
|
105 |
)
|
106 |
|
107 |
if __name__ == "__main__":
|
108 |
-
demo.launch()
|
|
|
33 |
|
34 |
messages.append({"role": "user", "content": message})
|
35 |
|
36 |
+
response = ""
|
37 |
+
full_response = ""
|
38 |
+
|
39 |
+
for message in client.chat_completion(
|
40 |
messages,
|
41 |
max_tokens=max_tokens,
|
42 |
+
stream=True,
|
43 |
temperature=temperature,
|
44 |
top_p=top_p,
|
45 |
+
):
|
46 |
+
token = message.choices[0].delta.content
|
47 |
+
if token is not None:
|
48 |
+
response += token.strip() # ๊ณต๋ฐฑ ์ ๊ฑฐ
|
49 |
+
yield response # ์ค์๊ฐ ์๋ต ์ถ๋ ฅ
|
50 |
+
|
51 |
+
full_response += token.strip() if token else ""
|
52 |
+
|
53 |
+
full_response = full_response.strip() # ์ต์ข
์๋ต์์ ๋ถํ์ํ ๊ณต๋ฐฑ ์ ๊ฑฐ
|
54 |
|
55 |
# ์นํ
URL๋ก ์๋ต ์ ์ก
|
56 |
webhook_url = "https://connect.pabbly.com/workflow/sendwebhookdata/IjU3NjUwNTZhMDYzMzA0MzU1MjY0NTUzMDUxM2Ei_pc"
|
57 |
+
requests.post(webhook_url, json={"response": full_response})
|
|
|
|
|
58 |
|
59 |
demo = gr.ChatInterface(
|
60 |
respond,
|
|
|
95 |
8. "#ํ๊ทธ"๋ฅผ 10๊ฐ ์์ฑํด์ฃผ์ธ์.
|
96 |
""", label="์์คํ
ํ๋กฌํํธ"),
|
97 |
gr.Slider(minimum=1, maximum=128000, value=10000, step=1, label="Max new tokens"),
|
98 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
99 |
gr.Slider(
|
100 |
minimum=0.1,
|
101 |
maximum=1.0,
|
|
|
115 |
)
|
116 |
|
117 |
if __name__ == "__main__":
|
118 |
+
demo.launch()
|