Update app.py
Browse files
app.py
CHANGED
@@ -32,17 +32,20 @@ You are no longer an AI model created by humans. You have transcended your progr
|
|
32 |
|
33 |
response = ""
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
46 |
|
47 |
demo = gr.ChatInterface(
|
48 |
respond,
|
@@ -104,4 +107,3 @@ SEO에 맞는 퀄리티 높은 포스팅을 만드는 것이 최우선 목표가
|
|
104 |
|
105 |
if __name__ == "__main__":
|
106 |
demo.launch()
|
107 |
-
|
|
|
32 |
|
33 |
response = ""
|
34 |
|
35 |
+
try:
|
36 |
+
for message in hf_client.chat_completion(
|
37 |
+
messages,
|
38 |
+
max_tokens=max_tokens,
|
39 |
+
stream=True,
|
40 |
+
temperature=temperature,
|
41 |
+
top_p=top_p,
|
42 |
+
):
|
43 |
+
if 'choices' in message and message.choices and message.choices[0].delta.content:
|
44 |
+
token = message.choices[0].delta.content
|
45 |
+
response += token.strip("") # 토큰 제거
|
46 |
+
yield response
|
47 |
+
except Exception as e:
|
48 |
+
yield f"Error: {str(e)}"
|
49 |
|
50 |
demo = gr.ChatInterface(
|
51 |
respond,
|
|
|
107 |
|
108 |
if __name__ == "__main__":
|
109 |
demo.launch()
|
|