Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,6 +49,8 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
| 49 |
generated_text = None
|
| 50 |
# Get the last message from the generated text
|
| 51 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
|
|
|
|
| 52 |
|
| 53 |
def extract_content_after_output(text):
|
| 54 |
"""
|
|
@@ -65,12 +67,11 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
| 65 |
# If 'output' is not found, return an empty string
|
| 66 |
return "Retry to get output, the model failed to generated required output(This occurs rarely🤷♂️)"
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
-
except Exception as e:
|
| 73 |
-
return f"Generation error: {e}"
|
| 74 |
|
| 75 |
demo = gr.ChatInterface(
|
| 76 |
respond,
|
|
|
|
| 49 |
generated_text = None
|
| 50 |
# Get the last message from the generated text
|
| 51 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 52 |
+
except Exception as e:
|
| 53 |
+
return f"Generation error: {e}"
|
| 54 |
|
| 55 |
def extract_content_after_output(text):
|
| 56 |
"""
|
|
|
|
| 67 |
# If 'output' is not found, return an empty string
|
| 68 |
return "Retry to get output, the model failed to generated required output(This occurs rarely🤷♂️)"
|
| 69 |
|
| 70 |
+
lines = extract_user_content(generated_text)
|
| 71 |
|
| 72 |
+
return lines
|
| 73 |
+
|
| 74 |
|
|
|
|
|
|
|
| 75 |
|
| 76 |
demo = gr.ChatInterface(
|
| 77 |
respond,
|