seawolf2357 commited on
Commit
1041f04
ยท
verified ยท
1 Parent(s): 4f58458

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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
- output += response.token.text
 
 
 
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"],