Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ from peft import PeftModel
|
|
11 |
|
12 |
# Constants
|
13 |
MAX_MAX_NEW_TOKENS = 2048
|
14 |
-
DEFAULT_MAX_NEW_TOKENS =
|
15 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
16 |
|
17 |
# Description and License Texts
|
@@ -99,15 +99,11 @@ def generate(
|
|
99 |
t.start()
|
100 |
|
101 |
outputs = []
|
102 |
-
end_phrase = "the end."
|
103 |
for text in streamer:
|
104 |
processed_text = process_text(text)
|
105 |
outputs.append(processed_text)
|
106 |
-
|
107 |
-
yield
|
108 |
-
# Check if 'the end.' is in the current output, case-insensitive
|
109 |
-
if end_phrase in current_output.lower():
|
110 |
-
break # Stop generating further if 'the end.' is found
|
111 |
|
112 |
final_story = "".join(outputs)
|
113 |
try:
|
|
|
11 |
|
12 |
# Constants
|
13 |
MAX_MAX_NEW_TOKENS = 2048
|
14 |
+
DEFAULT_MAX_NEW_TOKENS = 930
|
15 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
16 |
|
17 |
# Description and License Texts
|
|
|
99 |
t.start()
|
100 |
|
101 |
outputs = []
|
|
|
102 |
for text in streamer:
|
103 |
processed_text = process_text(text)
|
104 |
outputs.append(processed_text)
|
105 |
+
output = "".join(outputs)
|
106 |
+
yield output
|
|
|
|
|
|
|
107 |
|
108 |
final_story = "".join(outputs)
|
109 |
try:
|