Update app.py
Browse files
app.py
CHANGED
@@ -55,23 +55,33 @@ def respond(
|
|
55 |
token = message.choices[0].delta.content
|
56 |
if token is not None:
|
57 |
response += token.strip("") # ν ν° μ κ±°
|
58 |
-
yield response
|
59 |
|
60 |
# Convert the response to speech
|
61 |
wav_path = text_to_speech(response)
|
62 |
|
63 |
return response, wav_path
|
64 |
|
65 |
-
demo = gr.
|
66 |
-
respond,
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
examples=[
|
69 |
["λ°λμ νκΈλ‘ λ΅λ³νλΌ"],
|
70 |
["μμ΄μ¬λλμ μλλ μ΄λμ§?"],
|
71 |
["ν₯λ―Έλ‘μ΄ μ£Όμ λ₯Ό μλ €μ€"],
|
72 |
["κ³μ μ΄μ΄μ λ΅λ³νλΌ"],
|
73 |
],
|
74 |
-
cache_examples=False
|
75 |
)
|
76 |
|
77 |
if __name__ == "__main__":
|
|
|
55 |
token = message.choices[0].delta.content
|
56 |
if token is not None:
|
57 |
response += token.strip("") # ν ν° μ κ±°
|
|
|
58 |
|
59 |
# Convert the response to speech
|
60 |
wav_path = text_to_speech(response)
|
61 |
|
62 |
return response, wav_path
|
63 |
|
64 |
+
demo = gr.Interface(
|
65 |
+
fn=respond,
|
66 |
+
inputs=[
|
67 |
+
gr.Textbox(lines=2, placeholder="λ©μμ§λ₯Ό μ
λ ₯νμΈμ..."),
|
68 |
+
gr.State(value=[]),
|
69 |
+
gr.Textbox(lines=2, placeholder="μμ€ν
λ©μμ§λ₯Ό μ
λ ₯νμΈμ..."),
|
70 |
+
gr.Slider(minimum=1, maximum=128000, value=10000, step=1, label="Max new tokens"),
|
71 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
72 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
73 |
+
],
|
74 |
+
outputs=[
|
75 |
+
gr.Textbox(label="μλ΅"),
|
76 |
+
gr.Audio(label="μμ± νμΌ", type="file")
|
77 |
+
],
|
78 |
examples=[
|
79 |
["λ°λμ νκΈλ‘ λ΅λ³νλΌ"],
|
80 |
["μμ΄μ¬λλμ μλλ μ΄λμ§?"],
|
81 |
["ν₯λ―Έλ‘μ΄ μ£Όμ λ₯Ό μλ €μ€"],
|
82 |
["κ³μ μ΄μ΄μ λ΅λ³νλΌ"],
|
83 |
],
|
84 |
+
cache_examples=False # μΊμ± λΉνμ±ν μ€μ
|
85 |
)
|
86 |
|
87 |
if __name__ == "__main__":
|