Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -10,15 +10,22 @@ import ollama 
     | 
|
| 10 | 
         
             
            # List of available models for selection.
         
     | 
| 11 | 
         
             
            # IMPORTANT: These names must correspond to models that have been either
         
     | 
| 12 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 13 | 
         
             
            # Model from run.sh
         
     | 
| 14 | 
         
             
            AVAILABLE_MODELS = [
         
     | 
| 15 | 
         
            -
                'hf.co/bartowski/Qwen_Qwen3-1.7B-GGUF:Q4_K_M',
         
     | 
| 16 | 
         
             
                'hf.co/bartowski/Qwen_Qwen3-4B-Instruct-2507-GGUF:Q4_K_M',
         
     | 
| 17 | 
         
             
                #'hf.co/bartowski/Qwen_Qwen3-4B-Thinking-2507-GGUF:Q4_K_M',
         
     | 
| 18 | 
         
            -
                'hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M', # OK speed with CPU
         
     | 
| 19 | 
         
             
                'smollm2:360m-instruct-q5_K_M',
         
     | 
| 20 | 
         
            -
                 
     | 
| 21 | 
         
            -
                'gemma3n:e2b-it-q4_K_M',
         
     | 
| 22 | 
         
             
                'granite3.3:2b',
         
     | 
| 23 | 
         
             
                'hf.co/bartowski/tencent_Hunyuan-4B-Instruct-GGUF:Q4_K_M'
         
     | 
| 24 | 
         
             
            ]
         
     | 
| 
         @@ -29,12 +36,10 @@ AVAILABLE_MODELS = [ 
     | 
|
| 29 | 
         | 
| 30 | 
         | 
| 31 | 
         
             
            # Default System Prompt
         
     | 
| 32 | 
         
            -
            DEFAULT_SYSTEM_PROMPT = """
         
     | 
| 33 | 
         
             
                1. 如果查詢是以中文輸入,使用標準繁體中文回答,符合官方文書規範 
         
     | 
| 34 | 
         
             
                2. 要提供引用規則依据
         
     | 
| 35 | 
         
            -
                3. 如果查詢是以英文輸入,使用英文回答
         
     | 
| 36 | 
         
            -
                4. Answer everything in simple, smart, relevant and accurate style. No chatty!
         
     | 
| 37 | 
         
            -
                """
         
     | 
| 38 | 
         | 
| 39 | 
         
             
            # --- Gradio Interface ---
         
     | 
| 40 | 
         
             
            with gr.Blocks(theme=gr.themes.Default(primary_hue="blue", secondary_hue="neutral")) as demo:
         
     | 
| 
         | 
|
| 10 | 
         
             
            # List of available models for selection.
         
     | 
| 11 | 
         
             
            # IMPORTANT: These names must correspond to models that have been either
         
     | 
| 12 | 
         | 
| 13 | 
         
            +
            ollama pull hf.co/bartowski/Qwen_Qwen3-4B-Instruct-2507-GGUF:Q4_K_M
         
     | 
| 14 | 
         
            +
            #ollama pull hf.co/bartowski/Qwen_Qwen3-4B-Thinking-2507-GGUF:Q4_K_M
         
     | 
| 15 | 
         
            +
            ollama pull smollm2:360m-instruct-q5_K_M
         
     | 
| 16 | 
         
            +
            ollama pull hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M
         
     | 
| 17 | 
         
            +
            #ollama pull gemma3n:e2b-it-q4_K_M #slow on Spaces CPU
         
     | 
| 18 | 
         
            +
            ollama pull granite3.3:2b
         
     | 
| 19 | 
         
            +
            ollama pull hf.co/bartowski/tencent_Hunyuan-4B-Instruct-GGUF:Q4_K_M
         
     | 
| 20 | 
         
            +
             
     | 
| 21 | 
         
            +
             
     | 
| 22 | 
         
             
            # Model from run.sh
         
     | 
| 23 | 
         
             
            AVAILABLE_MODELS = [
         
     | 
| 
         | 
|
| 24 | 
         
             
                'hf.co/bartowski/Qwen_Qwen3-4B-Instruct-2507-GGUF:Q4_K_M',
         
     | 
| 25 | 
         
             
                #'hf.co/bartowski/Qwen_Qwen3-4B-Thinking-2507-GGUF:Q4_K_M',
         
     | 
| 
         | 
|
| 26 | 
         
             
                'smollm2:360m-instruct-q5_K_M',
         
     | 
| 27 | 
         
            +
                'hf.co/bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M', # OK speed with CPU
         
     | 
| 28 | 
         
            +
                #'gemma3n:e2b-it-q4_K_M',
         
     | 
| 29 | 
         
             
                'granite3.3:2b',
         
     | 
| 30 | 
         
             
                'hf.co/bartowski/tencent_Hunyuan-4B-Instruct-GGUF:Q4_K_M'
         
     | 
| 31 | 
         
             
            ]
         
     | 
| 
         | 
|
| 36 | 
         | 
| 37 | 
         | 
| 38 | 
         
             
            # Default System Prompt
         
     | 
| 39 | 
         
            +
            DEFAULT_SYSTEM_PROMPT = """Answer everything in simple, smart, relevant and accurate style. No chatty! Besides, pls:
         
     | 
| 40 | 
         
             
                1. 如果查詢是以中文輸入,使用標準繁體中文回答,符合官方文書規範 
         
     | 
| 41 | 
         
             
                2. 要提供引用規則依据
         
     | 
| 42 | 
         
            +
                3. 如果查詢是以英文輸入,使用英文回答"""
         
     | 
| 
         | 
|
| 
         | 
|
| 43 | 
         | 
| 44 | 
         
             
            # --- Gradio Interface ---
         
     | 
| 45 | 
         
             
            with gr.Blocks(theme=gr.themes.Default(primary_hue="blue", secondary_hue="neutral")) as demo:
         
     |