Spaces:
Running
Running
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import os
|
|
5 |
# 환경 변수에서 Hugging Face API 토큰을 가져옵니다.
|
6 |
ACCESS_TOKEN = os.getenv("HF_TOKEN")
|
7 |
|
8 |
-
def respond(message, system_message, max_tokens=512, temperature=0.7, top_p=0.95):
|
9 |
# 메시지를 구성
|
10 |
data = {
|
11 |
"model": "command-r-plus:104b-fp16",
|
@@ -21,25 +21,19 @@ def respond(message, system_message, max_tokens=512, temperature=0.7, top_p=0.95
|
|
21 |
|
22 |
return generated_text # 생성된 텍스트 반환
|
23 |
|
24 |
-
|
25 |
demo = gr.ChatInterface(
|
26 |
-
respond,
|
27 |
-
|
28 |
-
gr.Textbox(
|
29 |
-
gr.
|
30 |
-
gr.Slider(minimum=
|
31 |
-
gr.Slider(
|
32 |
-
|
33 |
-
maximum=1.0,
|
34 |
-
value=0.95,
|
35 |
-
step=0.05,
|
36 |
-
label="Top-P",
|
37 |
-
),
|
38 |
-
|
39 |
],
|
40 |
-
|
41 |
-
theme="Nymbo/Nymbo_Theme"
|
42 |
)
|
|
|
43 |
if __name__ == "__main__":
|
44 |
demo.launch()
|
45 |
-
|
|
|
5 |
# 환경 변수에서 Hugging Face API 토큰을 가져옵니다.
|
6 |
ACCESS_TOKEN = os.getenv("HF_TOKEN")
|
7 |
|
8 |
+
def respond(message, system_message="", max_tokens=512, temperature=0.7, top_p=0.95):
|
9 |
# 메시지를 구성
|
10 |
data = {
|
11 |
"model": "command-r-plus:104b-fp16",
|
|
|
21 |
|
22 |
return generated_text # 생성된 텍스트 반환
|
23 |
|
24 |
+
# Gradio ChatInterface 설정
|
25 |
demo = gr.ChatInterface(
|
26 |
+
fn=respond,
|
27 |
+
inputs=[
|
28 |
+
gr.Textbox(label="Your Message", placeholder="Type your message here..."),
|
29 |
+
gr.Textbox(label="System Message", placeholder="Optional system message...", default=""),
|
30 |
+
gr.Slider(minimum=1, maximum=2048, value=512, label="Max Tokens"),
|
31 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, label="Temperature"),
|
32 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, label="Top-P")
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
],
|
34 |
+
outputs=gr.Textbox(),
|
35 |
+
theme="Nymbo/Nymbo_Theme"
|
36 |
)
|
37 |
+
|
38 |
if __name__ == "__main__":
|
39 |
demo.launch()
|
|