Spaces:
Runtime error
Runtime error
franz96521
commited on
Commit
·
3d23bde
1
Parent(s):
4974498
Interactive
Browse files
app.py
CHANGED
@@ -12,10 +12,12 @@ data_path = path+'Tokenized_data/'
|
|
12 |
prefix= '<|startoftext|>'
|
13 |
sufix ='<|endoftext|>'
|
14 |
|
15 |
-
print("GPU is", "available" if tf.test.is_gpu_available() else "NOT AVAILABLE")
|
16 |
|
17 |
|
18 |
def generateAbstract(text):
|
|
|
|
|
|
|
19 |
sess = gpt2.start_tf_sess()
|
20 |
gpt2.load_gpt2(sess,checkpoint_dir=checkpoint_dir,run_name='run1')
|
21 |
txt = gpt2.generate(sess,prefix=str(text)+"\nABSTRACT", return_as_list=True,truncate=sufix,checkpoint_dir=checkpoint_dir,nsamples=1)[0]
|
@@ -24,4 +26,4 @@ def generateAbstract(text):
|
|
24 |
|
25 |
|
26 |
iface = gr.Interface(fn=generateAbstract, inputs=gr.inputs.Textbox(lines=10, placeholder="text"), outputs="textbox")
|
27 |
-
iface.launch()
|
|
|
12 |
prefix= '<|startoftext|>'
|
13 |
sufix ='<|endoftext|>'
|
14 |
|
|
|
15 |
|
16 |
|
17 |
def generateAbstract(text):
|
18 |
+
# with tf.compat.v1.variable_scope("weight", reuse = True):
|
19 |
+
#sess = tf.compat.v1.get_variable('sess',gpt2.start_tf_sess())
|
20 |
+
tf.compat.v1.reset_default_graph()
|
21 |
sess = gpt2.start_tf_sess()
|
22 |
gpt2.load_gpt2(sess,checkpoint_dir=checkpoint_dir,run_name='run1')
|
23 |
txt = gpt2.generate(sess,prefix=str(text)+"\nABSTRACT", return_as_list=True,truncate=sufix,checkpoint_dir=checkpoint_dir,nsamples=1)[0]
|
|
|
26 |
|
27 |
|
28 |
iface = gr.Interface(fn=generateAbstract, inputs=gr.inputs.Textbox(lines=10, placeholder="text"), outputs="textbox")
|
29 |
+
iface.launch(debug = True )
|