Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,22 +10,23 @@ system_instructions = "You will be provided with text, and your task is to class
|
|
| 10 |
def classify_task(prompt):
|
| 11 |
generate_kwargs = dict(
|
| 12 |
temperature=0.5,
|
| 13 |
-
max_new_tokens=
|
| 14 |
-
top_p=0.
|
| 15 |
-
repetition_penalty=1.
|
| 16 |
do_sample=True,
|
| 17 |
seed=42,
|
| 18 |
)
|
| 19 |
|
| 20 |
-
formatted_prompt = system_instructions + prompt
|
| 21 |
stream = client.text_generation(
|
| 22 |
formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
| 23 |
output = ""
|
| 24 |
|
| 25 |
for response in stream:
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
| 29 |
|
| 30 |
# Create the Gradio interface
|
| 31 |
with gr.Blocks() as demo:
|
|
|
|
| 10 |
def classify_task(prompt):
|
| 11 |
generate_kwargs = dict(
|
| 12 |
temperature=0.5,
|
| 13 |
+
max_new_tokens=5,
|
| 14 |
+
top_p=0.7,
|
| 15 |
+
repetition_penalty=1.2,
|
| 16 |
do_sample=True,
|
| 17 |
seed=42,
|
| 18 |
)
|
| 19 |
|
| 20 |
+
formatted_prompt = system_instructions + prompt
|
| 21 |
stream = client.text_generation(
|
| 22 |
formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
| 23 |
output = ""
|
| 24 |
|
| 25 |
for response in stream:
|
| 26 |
+
if not response.token.text == "</s>":
|
| 27 |
+
output += response.token.text
|
| 28 |
+
|
| 29 |
+
return output
|
| 30 |
|
| 31 |
# Create the Gradio interface
|
| 32 |
with gr.Blocks() as demo:
|