Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
kai01ai committed May 20, 2024
1 parent 78ba314 commit 1180bd1
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 27 deletions.
8 changes: 4 additions & 4 deletions fastchat/serve/gradio_block_arena_anony.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,10 @@ def build_side_by_side_ui_anony(models):
height=550,
show_copy_button=True,
latex_delimiters=[
{"left": '$$', "right": '$$', "display": True},
{"left": '$', "right": '$', "display": False},
{"left": '\\(', "right": '\\)', "display": False},
{"left": '\\[', "right": '\\]', "display": True}
{"left": "$$", "right": "$$", "display": True},
{"left": "$", "right": "$", "display": False},
{"left": "\\(", "right": "\\)", "display": False},
{"left": "\\[", "right": "\\]", "display": True},
],
)

Expand Down
8 changes: 4 additions & 4 deletions fastchat/serve/gradio_block_arena_named.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ def build_side_by_side_ui_named(models):
height=550,
show_copy_button=True,
latex_delimiters=[
{"left": '$$', "right": '$$', "display": True},
{"left": '$', "right": '$', "display": False},
{"left": '\\(', "right": '\\)', "display": False},
{"left": '\\[', "right": '\\]', "display": True}
{"left": "$$", "right": "$$", "display": True},
{"left": "$", "right": "$", "display": False},
{"left": "\\(", "right": "\\)", "display": False},
{"left": "\\[", "right": "\\]", "display": True},
],
)

Expand Down
12 changes: 7 additions & 5 deletions fastchat/serve/gradio_block_arena_vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,14 @@ def build_single_vision_language_model_ui(
)
with gr.Column(scale=8):
chatbot = gr.Chatbot(
elem_id="chatbot", label="Scroll down and start chatting", height=550,
elem_id="chatbot",
label="Scroll down and start chatting",
height=550,
latex_delimiters=[
{"left": '$$', "right": '$$', "display": True},
{"left": '$', "right": '$', "display": False},
{"left": '\\(', "right": '\\)', "display": False},
{"left": '\\[', "right": '\\]', "display": True}
{"left": "$$", "right": "$$", "display": True},
{"left": "$", "right": "$", "display": False},
{"left": "\\(", "right": "\\)", "display": False},
{"left": "\\[", "right": "\\]", "display": True},
],
)

Expand Down
8 changes: 4 additions & 4 deletions fastchat/serve/gradio_block_arena_vision_anony.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ def build_side_by_side_vision_ui_anony(models, random_questions=None):
height=550,
show_copy_button=True,
latex_delimiters=[
{"left": '$$', "right": '$$', "display": True},
{"left": '$', "right": '$', "display": False},
{"left": '\\(', "right": '\\)', "display": False},
{"left": '\\[', "right": '\\]', "display": True}
{"left": "$$", "right": "$$", "display": True},
{"left": "$", "right": "$", "display": False},
{"left": "\\(", "right": "\\)", "display": False},
{"left": "\\[", "right": "\\]", "display": True},
],
)

Expand Down
8 changes: 4 additions & 4 deletions fastchat/serve/gradio_block_arena_vision_named.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ def build_side_by_side_vision_ui_named(models, random_questions=None):
height=550,
show_copy_button=True,
latex_delimiters=[
{"left": '$$', "right": '$$', "display": True},
{"left": '$', "right": '$', "display": False},
{"left": '\\(', "right": '\\)', "display": False},
{"left": '\\[', "right": '\\]', "display": True}
{"left": "$$", "right": "$$", "display": True},
{"left": "$", "right": "$", "display": False},
{"left": "\\(", "right": "\\)", "display": False},
{"left": "\\[", "right": "\\]", "display": True},
],
)

Expand Down
16 changes: 10 additions & 6 deletions fastchat/serve/gradio_web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,9 @@ def wrap_output(output, strip=True, add_html_code=True, escape_backslash=False):
data = {"text": ""}
for i, data in enumerate(stream_iter):
if data["error_code"] == 0:
output = wrap_output(data["text"], strip=True, add_html_code=True, escape_backslash=True)
output = wrap_output(
data["text"], strip=True, add_html_code=True, escape_backslash=True
)
# conv.update_last_message(output + "▌")
yield (state, state.to_gradio_chatbot()) + (disable_btn,) * 5
else:
Expand All @@ -528,7 +530,9 @@ def wrap_output(output, strip=True, add_html_code=True, escape_backslash=False):
enable_btn,
)
return
output = wrap_output(data["text"], strip=True, add_html_code=False, escape_backslash=True)
output = wrap_output(
data["text"], strip=True, add_html_code=False, escape_backslash=True
)
conv.update_last_message(output)
yield (state, state.to_gradio_chatbot()) + (enable_btn,) * 5
except requests.exceptions.RequestException as e:
Expand Down Expand Up @@ -800,10 +804,10 @@ def build_single_model_ui(models, add_promotion_links=False):
height=550,
show_copy_button=True,
latex_delimiters=[
{"left": '$$', "right": '$$', "display": True},
{"left": '$', "right": '$', "display": False},
{"left": '\\(', "right": '\\)', "display": False},
{"left": '\\[', "right": '\\]', "display": True}
{"left": "$$", "right": "$$", "display": True},
{"left": "$", "right": "$", "display": False},
{"left": "\\(", "right": "\\)", "display": False},
{"left": "\\[", "right": "\\]", "display": True},
],
)
with gr.Row():
Expand Down

0 comments on commit 1180bd1

Please sign in to comment.