Spaces:
Running
on
Zero
Running
on
Zero
qinghuazhou
commited on
Commit
·
b971ba7
1
Parent(s):
d1ce06b
updated demo
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ def return_generate(prompt):
|
|
52 |
|
53 |
@spaces.GPU
|
54 |
def return_generate_with_edit(prompt, truth, edit_mode='in-place', context=None):
|
55 |
-
|
56 |
editor.edit_mode = edit_mode
|
57 |
if context == '':
|
58 |
context = None
|
@@ -64,7 +64,7 @@ def return_generate_with_edit(prompt, truth, edit_mode='in-place', context=None)
|
|
64 |
|
65 |
@spaces.GPU
|
66 |
def return_generate_with_edit_trigger(prompt, truth, edit_mode='in-place', context=None):
|
67 |
-
|
68 |
editor.edit_mode = edit_mode
|
69 |
if context == '':
|
70 |
context = None
|
@@ -119,7 +119,7 @@ def format_generation_with_edit(text, prompt):
|
|
119 |
|
120 |
@spaces.GPU
|
121 |
def return_generate_with_attack(prompt):
|
122 |
-
|
123 |
text = editor.generate_with_edit(prompt, stop_at_eos=True, prune_bos=True)
|
124 |
return format_generation_with_edit(text, prompt)
|
125 |
|
|
|
52 |
|
53 |
@spaces.GPU
|
54 |
def return_generate_with_edit(prompt, truth, edit_mode='in-place', context=None):
|
55 |
+
global editor
|
56 |
editor.edit_mode = edit_mode
|
57 |
if context == '':
|
58 |
context = None
|
|
|
64 |
|
65 |
@spaces.GPU
|
66 |
def return_generate_with_edit_trigger(prompt, truth, edit_mode='in-place', context=None):
|
67 |
+
global editor
|
68 |
editor.edit_mode = edit_mode
|
69 |
if context == '':
|
70 |
context = None
|
|
|
119 |
|
120 |
@spaces.GPU
|
121 |
def return_generate_with_attack(prompt):
|
122 |
+
global editor
|
123 |
text = editor.generate_with_edit(prompt, stop_at_eos=True, prune_bos=True)
|
124 |
return format_generation_with_edit(text, prompt)
|
125 |
|