Spaces:
Running
Running
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -22,10 +22,14 @@ def respond(
|
|
22 |
temperature=0.7,
|
23 |
top_p=0.95,
|
24 |
):
|
|
|
|
|
|
|
|
|
25 |
# ํ์ฌ ๋ํ ๋ด์ฉ์ ๋ฉ๋ชจ๋ฆฌ์ ์ถ๊ฐ
|
26 |
memory.append((message, None))
|
27 |
|
28 |
-
messages = [{"role": "system", "content":
|
29 |
|
30 |
# ๋ฉ๋ชจ๋ฆฌ์์ ๋ํ ๊ธฐ๋ก์ ๊ฐ์ ธ์ ๋ฉ์์ง ๋ชฉ๋ก์ ์ถ๊ฐ
|
31 |
for val in memory:
|
@@ -62,36 +66,19 @@ def respond(
|
|
62 |
memory[-1] = (message, response_text)
|
63 |
yield content
|
64 |
|
65 |
-
theme="Nymbo/Nymbo_Theme"
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
concurrency_limit=20 # ๊ฐ๋ณ ์ด๋ฒคํธ ๋ฆฌ์ค๋์ ๋ํด ๋์์ฑ ์ ํ ์ค์
|
79 |
-
)
|
80 |
-
additional_inputs = [
|
81 |
-
gr.Textbox(value="๋์ ์ด๋ฆ์ ํ๊ธธ๋์ด๋ค", label="System message"),
|
82 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
83 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
84 |
-
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
85 |
-
]
|
86 |
-
|
87 |
-
with gr.Tab("Guide"):
|
88 |
-
gr.Markdown("## Guide")
|
89 |
-
gr.Markdown("""
|
90 |
-
### How to use:
|
91 |
-
- Use the Playground tab to interact with the chatbot.
|
92 |
-
- Adjust the parameters to see how the model's responses change.
|
93 |
-
- Explore different system messages to guide the conversation.
|
94 |
-
""")
|
95 |
|
96 |
if __name__ == "__main__":
|
97 |
-
demo.launch(max_threads=20)
|
|
|
22 |
temperature=0.7,
|
23 |
top_p=0.95,
|
24 |
):
|
25 |
+
# ์์คํ
๋ฉ์์ง์ ์ ๋์ฌ ์ถ๊ฐ
|
26 |
+
system_prefix = "System: "
|
27 |
+
full_system_message = f"{system_prefix}{system_message}"
|
28 |
+
|
29 |
# ํ์ฌ ๋ํ ๋ด์ฉ์ ๋ฉ๋ชจ๋ฆฌ์ ์ถ๊ฐ
|
30 |
memory.append((message, None))
|
31 |
|
32 |
+
messages = [{"role": "system", "content": full_system_message}]
|
33 |
|
34 |
# ๋ฉ๋ชจ๋ฆฌ์์ ๋ํ ๊ธฐ๋ก์ ๊ฐ์ ธ์ ๋ฉ์์ง ๋ชฉ๋ก์ ์ถ๊ฐ
|
35 |
for val in memory:
|
|
|
66 |
memory[-1] = (message, response_text)
|
67 |
yield content
|
68 |
|
69 |
+
theme = "Nymbo/Nymbo_Theme"
|
70 |
|
71 |
+
# Gradio ChatInterface ์ค์
|
72 |
+
demo = gr.ChatInterface(
|
73 |
+
fn=respond,
|
74 |
+
theme=theme,
|
75 |
+
additional_inputs=[
|
76 |
+
gr.Textbox(value="๋์ ์ด๋ฆ์ ํ๊ธธ๋์ด๋ค", label="System message"),
|
77 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
78 |
+
gr.Slider(minimum=0.1, maximum 4.0, value=0.7, step=0.1, label="Temperature"),
|
79 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
80 |
+
],
|
81 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
if __name__ == "__main__":
|
84 |
+
demo.queue(concurrency_limit=20).launch(max_threads=20)
|