Spaces:
				
			
			
	
			
			
		Paused
		
	
	
	
			
			
	
	
	
	
		
		
		Paused
		
	
		NGUYEN, Xuan Phi
		
	commited on
		
		
					Commit 
							
							ยท
						
						c8aed7a
	
1
								Parent(s):
							
							93038e2
								
update
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -52,6 +52,7 @@ from multipurpose_chatbot.configs import ( 
     | 
|
| 52 | 
         
             
                BACKEND,
         
     | 
| 53 | 
         
             
                DEMOS,
         
     | 
| 54 | 
         
             
                DELETE_FOLDER,
         
     | 
| 
         | 
|
| 55 | 
         
             
            )
         
     | 
| 56 | 
         | 
| 57 | 
         | 
| 
         @@ -113,6 +114,7 @@ def launch_demo(): 
     | 
|
| 113 | 
         
             
                        tab_names=demos_names,
         
     | 
| 114 | 
         
             
                        title=f"{MODEL_TITLE}",
         
     | 
| 115 | 
         
             
                        description=descriptions,
         
     | 
| 
         | 
|
| 116 | 
         
             
                    )
         
     | 
| 117 | 
         | 
| 118 | 
         
             
                demo.title = MODEL_NAME
         
     | 
| 
         | 
|
| 52 | 
         
             
                BACKEND,
         
     | 
| 53 | 
         
             
                DEMOS,
         
     | 
| 54 | 
         
             
                DELETE_FOLDER,
         
     | 
| 55 | 
         
            +
                CSS,
         
     | 
| 56 | 
         
             
            )
         
     | 
| 57 | 
         | 
| 58 | 
         | 
| 
         | 
|
| 114 | 
         
             
                        tab_names=demos_names,
         
     | 
| 115 | 
         
             
                        title=f"{MODEL_TITLE}",
         
     | 
| 116 | 
         
             
                        description=descriptions,
         
     | 
| 117 | 
         
            +
                        css=CSS,
         
     | 
| 118 | 
         
             
                    )
         
     | 
| 119 | 
         | 
| 120 | 
         
             
                demo.title = MODEL_NAME
         
     | 
    	
        multipurpose_chatbot/configs.py
    CHANGED
    
    | 
         @@ -36,22 +36,48 @@ By using our service, you are required to agree to our <a href="https://huggingf 
     | 
|
| 36 | 
         
             
            </span>
         
     | 
| 37 | 
         
             
            """.strip()
         
     | 
| 38 | 
         | 
| 39 | 
         
            -
             
     | 
| 40 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 41 | 
         
             
            <div style='display:flex; gap: 0.25rem; '>
         
     | 
| 42 | 
         
            -
            <a href='https://damo-nlp-sg.github.io/SeaLLMs/'><img src='https://img.shields.io/badge/Blog-red'></a>
         
     | 
| 43 | 
         
            -
            <a href='https://github.com/damo-nlp-sg/seallms'><img src='https://img.shields.io/badge/ 
     | 
| 44 | 
         
            -
            <a href='https://huggingface.co/spaces/SeaLLMs/SeaLLM-7B-v2.5'><img src='https://img.shields.io/badge/%F0%9F%A4%97 
     | 
| 45 | 
         
            -
            <a href='https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5'><img src='https://img.shields.io/badge/%F0%9F%A4%97 
     | 
| 46 | 
         
            -
            <a href='https://arxiv.org/pdf/2312.00738.pdf'><img src='https://img.shields.io/badge/Paper-red'></a>
         
     | 
| 47 | 
         
             
            </div>
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 48 | 
         
             
            <span style="font-size: larger">
         
     | 
| 49 | 
         
            -
            <a href="https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5" target="_blank">SeaLLM-7B-v2.5</a> - a assistant for Southeast Asian Languages ๐ฌ๐ง ๐ป๐ณ ๐ฎ๐ฉ ๐น๐ญ ๐ฒ๐พ ๐ฐ๐ญ ๐ฑ๐ฆ ๐ต๐ญ ๐ฒ๐ฒ.
         
     | 
| 50 | 
         
             
            </span>
         
     | 
| 51 | 
         
             
            <br>
         
     | 
| 52 | 
         
             
            <span>
         
     | 
| 53 | 
         
             
            <span style="color: red">The chatbot may produce false and harmful content!</span>
         
     | 
| 54 | 
         
            -
            By using our service, you  
     | 
| 55 | 
         
             
            </span>
         
     | 
| 56 | 
         
             
            """.strip()
         
     | 
| 57 | 
         
             
            # <span>
         
     | 
| 
         @@ -86,8 +112,29 @@ If you find our project useful, hope you can star our repo and cite our paper as 
     | 
|
| 86 | 
         
             
              year = 2023,
         
     | 
| 87 | 
         
             
            }
         
     | 
| 88 | 
         
             
            ```
         
     | 
| 
         | 
|
| 89 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 90 | 
         
             
            """
         
     | 
| 
         | 
|
| 91 | 
         
             
            USE_PANEL = bool(int(os.environ.get("USE_PANEL", "1")))
         
     | 
| 92 | 
         
             
            CHATBOT_HEIGHT = int(os.environ.get("CHATBOT_HEIGHT", "500"))
         
     | 
| 93 | 
         | 
| 
         | 
|
| 36 | 
         
             
            </span>
         
     | 
| 37 | 
         
             
            """.strip()
         
     | 
| 38 | 
         | 
| 39 | 
         
            +
             
     | 
| 40 | 
         
            +
            MODEL_TITLE = """
         
     | 
| 41 | 
         
            +
            <img src="file/seal_logo.png" style="
         
     | 
| 42 | 
         
            +
                max-width: 10em;
         
     | 
| 43 | 
         
            +
                max-height: 5%;
         
     | 
| 44 | 
         
            +
                height: 3em;
         
     | 
| 45 | 
         
            +
                width: 3em;
         
     | 
| 46 | 
         
            +
            ">
         
     | 
| 47 | 
         
            +
            <div class="text" style="
         
     | 
| 48 | 
         
            +
                float: left;
         
     | 
| 49 | 
         
            +
                padding-left: 2%;
         
     | 
| 50 | 
         
            +
                font-size: larger;
         
     | 
| 51 | 
         
            +
                margin-bottom: -1em;
         
     | 
| 52 | 
         
            +
                margin-top: -1em;
         
     | 
| 53 | 
         
            +
            ">
         
     | 
| 54 | 
         
            +
            SeaLLMs - Large Language Models for Southeast Asia
         
     | 
| 55 | 
         
             
            <div style='display:flex; gap: 0.25rem; '>
         
     | 
| 56 | 
         
            +
            <a href='https://damo-nlp-sg.github.io/SeaLLMs/'><img class="tag" src='https://img.shields.io/badge/Blog-red'></a>
         
     | 
| 57 | 
         
            +
            <a href='https://github.com/damo-nlp-sg/seallms'><img class="tag" src='https://img.shields.io/badge/Code-success'></a>
         
     | 
| 58 | 
         
            +
            <a href='https://huggingface.co/spaces/SeaLLMs/SeaLLM-7B-v2.5'><img class="tag" src='https://img.shields.io/badge/%F0%9F%A4%97-Spaces-blue'></a> 
         
     | 
| 59 | 
         
            +
            <a href='https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5'><img class="tag" src='https://img.shields.io/badge/%F0%9F%A4%97-Model-blue'></a> 
         
     | 
| 60 | 
         
            +
            <a href='https://arxiv.org/pdf/2312.00738.pdf'><img class="tag" src='https://img.shields.io/badge/Paper-red'></a>
         
     | 
| 61 | 
         
             
            </div>
         
     | 
| 62 | 
         
            +
            </div>
         
     | 
| 63 | 
         
            +
            """
         
     | 
| 64 | 
         
            +
             
     | 
| 65 | 
         
            +
            # Explore <a href="https://huggingface.co/spaces/SeaLLMs/SeaLLM-7B" target="_blank">SeaLMMM-7B</a> - our multi-modal version of SeaLLMs.
         
     | 
| 66 | 
         
            +
            # <div style='display:flex; gap: 0.25rem; '>
         
     | 
| 67 | 
         
            +
            # <a href='https://damo-nlp-sg.github.io/SeaLLMs/'><img class="tag" src='https://img.shields.io/badge/Blog-red'></a>
         
     | 
| 68 | 
         
            +
            # <a href='https://github.com/damo-nlp-sg/seallms'><img class="tag" src='https://img.shields.io/badge/Code-success'></a>
         
     | 
| 69 | 
         
            +
            # <a href='https://huggingface.co/spaces/SeaLLMs/SeaLLM-7B-v2.5'><img class="tag" src='https://img.shields.io/badge/%F0%9F%A4%97-Spaces-blue'></a> 
         
     | 
| 70 | 
         
            +
            # <a href='https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5'><img class="tag" src='https://img.shields.io/badge/%F0%9F%A4%97-Model-blue'></a> 
         
     | 
| 71 | 
         
            +
            # <a href='https://arxiv.org/pdf/2312.00738.pdf'><img class="tag" src='https://img.shields.io/badge/Paper-red'></a>
         
     | 
| 72 | 
         
            +
            # </div>
         
     | 
| 73 | 
         
            +
            MODEL_DESC = f"""
         
     | 
| 74 | 
         
             
            <span style="font-size: larger">
         
     | 
| 75 | 
         
            +
            <a href="https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5" target="_blank">SeaLLM-7B-v2.5</a> - a helpful assistant for Southeast Asian Languages ๐ฌ๐ง ๐ป๐ณ ๐ฎ๐ฉ ๐น๐ญ ๐ฒ๐พ ๐ฐ๐ญ ๐ฑ๐ฆ ๐ต๐ญ ๐ฒ๐ฒ.
         
     | 
| 76 | 
         
             
            </span>
         
     | 
| 77 | 
         
             
            <br>
         
     | 
| 78 | 
         
             
            <span>
         
     | 
| 79 | 
         
             
            <span style="color: red">The chatbot may produce false and harmful content!</span>
         
     | 
| 80 | 
         
            +
            By using our service, you agree to our <a href="https://huggingface.co/SeaLLMs/SeaLLM-Chat-13b/blob/main/LICENSE" target="_blank" style="color: red">Terms Of Use</a>
         
     | 
| 81 | 
         
             
            </span>
         
     | 
| 82 | 
         
             
            """.strip()
         
     | 
| 83 | 
         
             
            # <span>
         
     | 
| 
         | 
|
| 112 | 
         
             
              year = 2023,
         
     | 
| 113 | 
         
             
            }
         
     | 
| 114 | 
         
             
            ```
         
     | 
| 115 | 
         
            +
            """
         
     | 
| 116 | 
         | 
| 117 | 
         
            +
             
     | 
| 118 | 
         
            +
            CSS = """
         
     | 
| 119 | 
         
            +
            .message-wrap.svelte-1lcyrx4>div.svelte-1lcyrx4  img {
         
     | 
| 120 | 
         
            +
                min-width: 200px;
         
     | 
| 121 | 
         
            +
                min-height: 150px;
         
     | 
| 122 | 
         
            +
                max-height: 600px;
         
     | 
| 123 | 
         
            +
                max-width; 90%;
         
     | 
| 124 | 
         
            +
                width: auto;
         
     | 
| 125 | 
         
            +
                object-fit: contain;
         
     | 
| 126 | 
         
            +
            }
         
     | 
| 127 | 
         
            +
            .panel-full-width.svelte-1lcyrx4.svelte-1lcyrx4.svelte-1lcyrx4 {
         
     | 
| 128 | 
         
            +
                padding: calc(var(--spacing-xxl) * 1);
         
     | 
| 129 | 
         
            +
                width: 100%
         
     | 
| 130 | 
         
            +
            }
         
     | 
| 131 | 
         
            +
             
     | 
| 132 | 
         
            +
            img.tag {
         
     | 
| 133 | 
         
            +
              max-height: 1.5em;
         
     | 
| 134 | 
         
            +
              width: auto;
         
     | 
| 135 | 
         
            +
            }
         
     | 
| 136 | 
         
             
            """
         
     | 
| 137 | 
         
            +
             
     | 
| 138 | 
         
             
            USE_PANEL = bool(int(os.environ.get("USE_PANEL", "1")))
         
     | 
| 139 | 
         
             
            CHATBOT_HEIGHT = int(os.environ.get("CHATBOT_HEIGHT", "500"))
         
     | 
| 140 | 
         | 
    	
        multipurpose_chatbot/demos/base_demo.py
    CHANGED
    
    | 
         @@ -94,7 +94,8 @@ class CustomTabbedInterface(gr.Blocks): 
     | 
|
| 94 | 
         
             
                    with self:
         
     | 
| 95 | 
         
             
                        if title:
         
     | 
| 96 | 
         
             
                            gr.Markdown(
         
     | 
| 97 | 
         
            -
                                f"<h1 style='text-align: center; margin-bottom: 1rem'>{title}</h1>"
         
     | 
| 
         | 
|
| 98 | 
         
             
                            )
         
     | 
| 99 | 
         
             
                        if description:
         
     | 
| 100 | 
         
             
                            gr.Markdown(description)
         
     | 
| 
         | 
|
| 94 | 
         
             
                    with self:
         
     | 
| 95 | 
         
             
                        if title:
         
     | 
| 96 | 
         
             
                            gr.Markdown(
         
     | 
| 97 | 
         
            +
                                # f"<h1 style='text-align: center; margin-bottom: 1rem'>{title}</h1>"
         
     | 
| 98 | 
         
            +
                                f"<h1 style='text-align: center;'>{title}</h1>"
         
     | 
| 99 | 
         
             
                            )
         
     | 
| 100 | 
         
             
                        if description:
         
     | 
| 101 | 
         
             
                            gr.Markdown(description)
         
     | 
    	
        multipurpose_chatbot/demos/mm_chat_interface.py
    CHANGED
    
    | 
         @@ -76,6 +76,7 @@ from ..configs import ( 
     | 
|
| 76 | 
         
             
                IMAGE_TOKEN,
         
     | 
| 77 | 
         
             
                IMAGE_TOKEN_INTERACTIVE,
         
     | 
| 78 | 
         
             
                CHATBOT_HEIGHT,
         
     | 
| 
         | 
|
| 79 | 
         
             
            )
         
     | 
| 80 | 
         | 
| 81 | 
         
             
            from .multimodal_chat_interface import (
         
     | 
| 
         @@ -98,19 +99,6 @@ from .multimodal_chat_interface import ( 
     | 
|
| 98 | 
         | 
| 99 | 
         
             
            EXAMPLES_PER_PAGE = int(os.environ.get("EXAMPLES_PER_PAGE", 10))
         
     | 
| 100 | 
         | 
| 101 | 
         
            -
            CSS = """
         
     | 
| 102 | 
         
            -
            .message.svelte-1lcyrx4.svelte-1lcyrx4.svelte-1lcyrx4 {
         
     | 
| 103 | 
         
            -
                padding-top: 1em;
         
     | 
| 104 | 
         
            -
            }
         
     | 
| 105 | 
         
            -
            """
         
     | 
| 106 | 
         
            -
             
     | 
| 107 | 
         
            -
            CSS = """
         
     | 
| 108 | 
         
            -
            .panel-full-width.svelte-1lcyrx4.svelte-1lcyrx4.svelte-1lcyrx4 {
         
     | 
| 109 | 
         
            -
                padding: calc(var(--spacing-xxl) * 1);
         
     | 
| 110 | 
         
            -
                width: 100%
         
     | 
| 111 | 
         
            -
            }
         
     | 
| 112 | 
         
            -
            """
         
     | 
| 113 | 
         
            -
             
     | 
| 114 | 
         
             
            DOC_TEMPLATE = """###
         
     | 
| 115 | 
         
             
            {content}
         
     | 
| 116 | 
         
             
            ###
         
     | 
| 
         @@ -825,7 +813,7 @@ class VisionMMChatInterfaceDemo(ChatInterfaceDemo): 
     | 
|
| 825 | 
         
             
                    max_tokens = kwargs.get("max_tokens", MAX_TOKENS)
         
     | 
| 826 | 
         
             
                    temperature = kwargs.get("temperature", TEMPERATURE)
         
     | 
| 827 | 
         
             
                    model_name = kwargs.get("model_name", MODEL_NAME)
         
     | 
| 828 | 
         
            -
                    description = description 
     | 
| 829 | 
         | 
| 830 | 
         
             
                    assert MultimodalTextbox is not None
         
     | 
| 831 | 
         | 
| 
         | 
|
| 76 | 
         
             
                IMAGE_TOKEN,
         
     | 
| 77 | 
         
             
                IMAGE_TOKEN_INTERACTIVE,
         
     | 
| 78 | 
         
             
                CHATBOT_HEIGHT,
         
     | 
| 79 | 
         
            +
                CSS,
         
     | 
| 80 | 
         
             
            )
         
     | 
| 81 | 
         | 
| 82 | 
         
             
            from .multimodal_chat_interface import (
         
     | 
| 
         | 
|
| 99 | 
         | 
| 100 | 
         
             
            EXAMPLES_PER_PAGE = int(os.environ.get("EXAMPLES_PER_PAGE", 10))
         
     | 
| 101 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 102 | 
         
             
            DOC_TEMPLATE = """###
         
     | 
| 103 | 
         
             
            {content}
         
     | 
| 104 | 
         
             
            ###
         
     | 
| 
         | 
|
| 813 | 
         
             
                    max_tokens = kwargs.get("max_tokens", MAX_TOKENS)
         
     | 
| 814 | 
         
             
                    temperature = kwargs.get("temperature", TEMPERATURE)
         
     | 
| 815 | 
         
             
                    model_name = kwargs.get("model_name", MODEL_NAME)
         
     | 
| 816 | 
         
            +
                    # description = description
         
     | 
| 817 | 
         | 
| 818 | 
         
             
                    assert MultimodalTextbox is not None
         
     | 
| 819 | 
         |