Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -50,18 +50,12 @@ model = model.to(device)
|
|
50 |
# Spacesμ GPU μμμ μ¬μ©νμ¬ chat ν¨μ μ€ν. μ΅λ 60μ΄ λμ GPU μμ μ¬μ© κ°λ₯.
|
51 |
@spaces.GPU(duration=60)
|
52 |
def chat(message, history, temperature, do_sample, max_tokens):
|
53 |
-
instruction = "You are a helpful assistant."
|
54 |
# μ±ν
κΈ°λ‘μ μ μ ν νμμΌλ‘ λ³ν
|
55 |
chat = []
|
56 |
for item in history:
|
57 |
chat.append({"role": "user", "content": item[0]})
|
58 |
if item[1] is not None:
|
59 |
chat.append({"role": "assistant", "content": item[1]})
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
chat.insert(0, {"role": "system", "content": instruction})
|
64 |
-
|
65 |
chat.append({"role": "user", "content": message})
|
66 |
|
67 |
# ν ν¬λμ΄μ λ₯Ό μ¬μ©νμ¬ μ
λ ₯ μ²λ¦¬
|
@@ -108,7 +102,7 @@ demo = gr.ChatInterface(
|
|
108 |
),
|
109 |
additional_inputs=[
|
110 |
gr.Slider(
|
111 |
-
minimum=0, maximum=1, step=0.1, value=0.
|
112 |
),
|
113 |
gr.Checkbox(label="Sampling", value=True),
|
114 |
gr.Slider(
|
|
|
50 |
# Spacesμ GPU μμμ μ¬μ©νμ¬ chat ν¨μ μ€ν. μ΅λ 60μ΄ λμ GPU μμ μ¬μ© κ°λ₯.
|
51 |
@spaces.GPU(duration=60)
|
52 |
def chat(message, history, temperature, do_sample, max_tokens):
|
|
|
53 |
# μ±ν
κΈ°λ‘μ μ μ ν νμμΌλ‘ λ³ν
|
54 |
chat = []
|
55 |
for item in history:
|
56 |
chat.append({"role": "user", "content": item[0]})
|
57 |
if item[1] is not None:
|
58 |
chat.append({"role": "assistant", "content": item[1]})
|
|
|
|
|
|
|
|
|
|
|
59 |
chat.append({"role": "user", "content": message})
|
60 |
|
61 |
# ν ν¬λμ΄μ λ₯Ό μ¬μ©νμ¬ μ
λ ₯ μ²λ¦¬
|
|
|
102 |
),
|
103 |
additional_inputs=[
|
104 |
gr.Slider(
|
105 |
+
minimum=0, maximum=1, step=0.1, value=0.7, label="Temperature", render=False
|
106 |
),
|
107 |
gr.Checkbox(label="Sampling", value=True),
|
108 |
gr.Slider(
|