jerry3638 commited on
Commit
9db8c40
Β·
1 Parent(s): 4c4dfa6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -24,19 +24,24 @@ def app():
24
  generator = pipeline("text-generation", model)
25
 
26
  # η”Ÿζˆζ–‡ζœ¬
27
- output = generator(input_text, max_length=int(maxlen), num_return_sequences=1)
28
 
29
  # ζε–η”Ÿζˆηš„ζ–‡ζœ¬
30
  generated_text = output[0]["generated_text"].strip()
31
 
32
  return generated_text
33
 
 
34
  if button_generate:
35
- # η”Ÿζˆζ–‡ζœ¬
36
- generated_text = generate_text(input_text)
37
-
38
- # ζ˜Ύη€Ίη”Ÿζˆηš„ζ–‡ζœ¬
39
- output_text.success(generated_text)
 
 
 
 
40
 
41
  if __name__ == "__main__":
42
  # θΏθ‘ŒεΊ”η”¨η¨‹εΊ
 
24
  generator = pipeline("text-generation", model)
25
 
26
  # η”Ÿζˆζ–‡ζœ¬
27
+ output = generator(input_text, max_length=int(10), num_return_sequences=1)
28
 
29
  # ζε–η”Ÿζˆηš„ζ–‡ζœ¬
30
  generated_text = output[0]["generated_text"].strip()
31
 
32
  return generated_text
33
 
34
+ generated_text = ""
35
  if button_generate:
36
+ current_len = 0
37
+ while current_len<maxlen:
38
+
39
+ # η”Ÿζˆζ–‡ζœ¬
40
+ generated_text += generate_text(input_text)
41
+
42
+ # ζ˜Ύη€Ίη”Ÿζˆηš„ζ–‡ζœ¬
43
+ output_text.success(generated_text)
44
+ current_len += 30
45
 
46
  if __name__ == "__main__":
47
  # θΏθ‘ŒεΊ”η”¨η¨‹εΊ