Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -175,6 +175,11 @@ As a multilingual assistant, you must respond and follow instructions in the nat
|
|
175 |
Your response should adapt to the norms and customs of the respective language and culture.
|
176 |
"""
|
177 |
|
|
|
|
|
|
|
|
|
|
|
178 |
# SYSTEM_PROMPT_1 = """You are a multilingual, helpful, respectful and honest assistant. \
|
179 |
# Please always answer as helpfully as possible, while being safe. Your \
|
180 |
# answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure \
|
@@ -778,8 +783,8 @@ def _setup_stop_events(
|
|
778 |
for event_trigger in event_triggers:
|
779 |
event_trigger(
|
780 |
lambda: (
|
781 |
-
Button
|
782 |
-
Button
|
783 |
),
|
784 |
None,
|
785 |
[self.submit_btn, self.stop_btn],
|
@@ -787,7 +792,7 @@ def _setup_stop_events(
|
|
787 |
queue=False,
|
788 |
)
|
789 |
event_to_cancel.then(
|
790 |
-
lambda: (Button
|
791 |
None,
|
792 |
[self.submit_btn, self.stop_btn],
|
793 |
api_name=False,
|
@@ -796,14 +801,14 @@ def _setup_stop_events(
|
|
796 |
else:
|
797 |
for event_trigger in event_triggers:
|
798 |
event_trigger(
|
799 |
-
lambda: Button
|
800 |
None,
|
801 |
[self.stop_btn],
|
802 |
api_name=False,
|
803 |
queue=False,
|
804 |
)
|
805 |
event_to_cancel.then(
|
806 |
-
lambda: Button
|
807 |
None,
|
808 |
[self.stop_btn],
|
809 |
api_name=False,
|
@@ -820,14 +825,14 @@ def _setup_stop_events(
|
|
820 |
if self.submit_btn:
|
821 |
for event_trigger in event_triggers:
|
822 |
event_trigger(
|
823 |
-
lambda: Button
|
824 |
None,
|
825 |
[self.submit_btn],
|
826 |
api_name=False,
|
827 |
queue=False,
|
828 |
)
|
829 |
event_to_cancel.then(
|
830 |
-
lambda: Button
|
831 |
None,
|
832 |
[self.submit_btn],
|
833 |
api_name=False,
|
@@ -836,7 +841,7 @@ def _setup_stop_events(
|
|
836 |
# upon clear, cancel the submit event as well
|
837 |
if self.clear_btn:
|
838 |
self.clear_btn.click(
|
839 |
-
lambda: ([], [], None, Button
|
840 |
None,
|
841 |
[self.chatbot, self.chatbot_state, self.saved_input, self.submit_btn],
|
842 |
queue=False,
|
@@ -1915,7 +1920,7 @@ def launch():
|
|
1915 |
|
1916 |
|
1917 |
demo.queue(api_open=False)
|
1918 |
-
demo.launch(server_port=PORT, show_api=False)
|
1919 |
|
1920 |
|
1921 |
def main():
|
|
|
175 |
Your response should adapt to the norms and customs of the respective language and culture.
|
176 |
"""
|
177 |
|
178 |
+
SYSTEM_PROMPT_1 = """You are a multilingual, helpful, respectful and honest assistant. You are built by DAMO Academy, Alibaba Group. \
|
179 |
+
Please always answer as helpfully as possible, while being safe. Your \
|
180 |
+
answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure \
|
181 |
+
that your responses are socially unbiased and positive in nature."""
|
182 |
+
|
183 |
# SYSTEM_PROMPT_1 = """You are a multilingual, helpful, respectful and honest assistant. \
|
184 |
# Please always answer as helpfully as possible, while being safe. Your \
|
185 |
# answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure \
|
|
|
783 |
for event_trigger in event_triggers:
|
784 |
event_trigger(
|
785 |
lambda: (
|
786 |
+
Button(visible=False),
|
787 |
+
Button(visible=True),
|
788 |
),
|
789 |
None,
|
790 |
[self.submit_btn, self.stop_btn],
|
|
|
792 |
queue=False,
|
793 |
)
|
794 |
event_to_cancel.then(
|
795 |
+
lambda: (Button(visible=True), Button(visible=False)),
|
796 |
None,
|
797 |
[self.submit_btn, self.stop_btn],
|
798 |
api_name=False,
|
|
|
801 |
else:
|
802 |
for event_trigger in event_triggers:
|
803 |
event_trigger(
|
804 |
+
lambda: Button(visible=True),
|
805 |
None,
|
806 |
[self.stop_btn],
|
807 |
api_name=False,
|
808 |
queue=False,
|
809 |
)
|
810 |
event_to_cancel.then(
|
811 |
+
lambda: Button(visible=False),
|
812 |
None,
|
813 |
[self.stop_btn],
|
814 |
api_name=False,
|
|
|
825 |
if self.submit_btn:
|
826 |
for event_trigger in event_triggers:
|
827 |
event_trigger(
|
828 |
+
lambda: Button(interactive=False),
|
829 |
None,
|
830 |
[self.submit_btn],
|
831 |
api_name=False,
|
832 |
queue=False,
|
833 |
)
|
834 |
event_to_cancel.then(
|
835 |
+
lambda: Button(interactive=True),
|
836 |
None,
|
837 |
[self.submit_btn],
|
838 |
api_name=False,
|
|
|
841 |
# upon clear, cancel the submit event as well
|
842 |
if self.clear_btn:
|
843 |
self.clear_btn.click(
|
844 |
+
lambda: ([], [], None, Button(interactive=True)),
|
845 |
None,
|
846 |
[self.chatbot, self.chatbot_state, self.saved_input, self.submit_btn],
|
847 |
queue=False,
|
|
|
1920 |
|
1921 |
|
1922 |
demo.queue(api_open=False)
|
1923 |
+
demo.launch(server_port=PORT, show_api=False, allowed_paths=["seal_logo.png"])
|
1924 |
|
1925 |
|
1926 |
def main():
|