Allow jpg profile images

This commit is contained in:
oobabooga 2023-01-15 15:45:25 -03:00
parent ada2e556d0
commit 027c3dd27d
3 changed files with 6 additions and 2 deletions

View file

@ -125,7 +125,7 @@ Optionally, you can use the following command-line flags:
| `--model MODEL` | Name of the model to load by default. |
| `--notebook` | Launch the webui in notebook mode, where the output is written to the same text box as the input. |
| `--chat` | Launch the webui in chat mode.|
| `--cai-chat` | Launch the webui in chat mode with a style similar to Character.AI's. If the file profile.png exists in the same folder as server.py, this image will be used as the bot's profile picture.|
| `--cai-chat` | Launch the webui in chat mode with a style similar to Character.AI's. If the file profile.png or profile.jpg exists in the same folder as server.py, this image will be used as the bot's profile picture. |
| `--cpu` | Use the CPU to generate text.|
| `--auto-devices` | Automatically split the model across the available GPU(s) and CPU.|
| `--load-in-8bit` | Load the model with 8-bit precision.|

View file

@ -216,6 +216,10 @@ def generate_chat_html(history, name1, name2):
output += f'<style>{css}</style><div class="chat" id="chat">'
if Path("profile.png").exists():
img = '<img src="file/profile.png">'
elif Path("profile.jpg").exists():
img = '<img src="file/profile.jpg">'
elif Path("profile.jpeg").exists():
img = '<img src="file/profile.jpeg">'
else:
img = ''

View file

@ -19,7 +19,7 @@ parser = argparse.ArgumentParser()
parser.add_argument('--model', type=str, help='Name of the model to load by default.')
parser.add_argument('--notebook', action='store_true', help='Launch the webui in notebook mode, where the output is written to the same text box as the input.')
parser.add_argument('--chat', action='store_true', help='Launch the webui in chat mode.')
parser.add_argument('--cai-chat', action='store_true', help='Launch the webui in chat mode with a style similar to Character.AI\'s. If the file profile.png exists in the same folder as server.py, this image will be used as the bot\'s profile picture.')
parser.add_argument('--cai-chat', action='store_true', help='Launch the webui in chat mode with a style similar to Character.AI\'s. If the file profile.png or profile.jpg exists in the same folder as server.py, this image will be used as the bot\'s profile picture.')
parser.add_argument('--cpu', action='store_true', help='Use the CPU to generate text.')
parser.add_argument('--auto-devices', action='store_true', help='Automatically split the model across the available GPU(s) and CPU.')
parser.add_argument('--load-in-8bit', action='store_true', help='Load the model with 8-bit precision.')