Update app.py
Browse files
app.py
CHANGED
@@ -99,10 +99,14 @@ def generate(prompt, history=[], temperature=0.1, max_new_tokens=25000, top_p=0.
|
|
99 |
top_p=top_p, repetition_penalty=repetition_penalty, do_sample=True, seed=42, stream=True)
|
100 |
output = ""
|
101 |
for response in stream:
|
102 |
-
|
|
|
|
|
|
|
103 |
yield output
|
104 |
except Exception as e:
|
105 |
-
yield f"Error: {str(e)}"
|
|
|
106 |
|
107 |
mychatbot = gr.Chatbot(
|
108 |
avatar_images=["./user.png", "./botm.png"],
|
|
|
99 |
top_p=top_p, repetition_penalty=repetition_penalty, do_sample=True, seed=42, stream=True)
|
100 |
output = ""
|
101 |
for response in stream:
|
102 |
+
if isinstance(response, dict) and 'generated_text' in response:
|
103 |
+
output += response['generated_text']
|
104 |
+
else:
|
105 |
+
output += str(response) # ์์ธ ์ฒ๋ฆฌ๋ฅผ ๊ฐ์ ํ์ฌ ๋ชจ๋ ์๋ต์ ๋ฌธ์์ด๋ก ์ฒ๋ฆฌ
|
106 |
yield output
|
107 |
except Exception as e:
|
108 |
+
yield f"Error: {str(e)} # ์๋ฌ ๋ก๊น
์ ๊ฐํํ์ฌ ๋ฌธ์ ๋ฅผ ์ข ๋ ๋ช
ํํ ์๋ณ"
|
109 |
+
|
110 |
|
111 |
mychatbot = gr.Chatbot(
|
112 |
avatar_images=["./user.png", "./botm.png"],
|