jason9693 commited on
Commit
6e1bbdd
1 Parent(s): 061e2e4

modified imple

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -14,8 +14,21 @@ examples = [
14
  ["2040년 미국은, "]
15
  ]
16
 
17
- generator = pipeline('text-generation', model=model_name, use_auth_token=os.environ['TOKEN'])
18
- gr.Interface.from_pipeline(generator).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
 
21
 
 
14
  ["2040년 미국은, "]
15
  ]
16
 
17
+ pipe = pipeline('text-generation', model=model_name, use_auth_token=os.environ['TOKEN'])
18
+
19
+ def predict(text):
20
+ return pipe(text, do_sample=True, return_full_text=False, max_length=100)[0]['generated_text']
21
+
22
+ iface = gr.Interface(
23
+ fn=predict,
24
+ inputs='text',
25
+ outputs='text',
26
+ examples=examples
27
+ )
28
+
29
+ iface.launch()
30
+
31
+
32
 
33
 
34