Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 1 | 
         
             
            import gradio as gr
         
     | 
| 2 | 
         | 
| 3 | 
         
            -
            # Custom  
     | 
| 4 | 
         
             
            purple_theme = gr.themes.Default(
         
     | 
| 5 | 
         
             
                primary_hue="purple",
         
     | 
| 6 | 
         
             
                secondary_hue="purple",
         
     | 
| 
         @@ -17,12 +17,21 @@ purple_theme = gr.themes.Default( 
     | 
|
| 17 | 
         
             
                block_label_text_color="#673AB7",
         
     | 
| 18 | 
         
             
            )
         
     | 
| 19 | 
         | 
| 20 | 
         
            -
            #  
     | 
| 21 | 
         
            -
             
     | 
| 22 | 
         
            -
             
     | 
| 23 | 
         
            -
             
     | 
| 24 | 
         
            -
            )
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 25 | 
         | 
| 26 | 
         
            -
            #  
     | 
| 27 | 
         
            -
             
     | 
| 28 | 
         
            -
            interface.launch()
         
     | 
| 
         | 
|
| 1 | 
         
             
            import gradio as gr
         
     | 
| 2 | 
         | 
| 3 | 
         
            +
            # Custom theme as before...
         
     | 
| 4 | 
         
             
            purple_theme = gr.themes.Default(
         
     | 
| 5 | 
         
             
                primary_hue="purple",
         
     | 
| 6 | 
         
             
                secondary_hue="purple",
         
     | 
| 
         | 
|
| 17 | 
         
             
                block_label_text_color="#673AB7",
         
     | 
| 18 | 
         
             
            )
         
     | 
| 19 | 
         | 
| 20 | 
         
            +
            # Load the model with no system prompt here
         
     | 
| 21 | 
         
            +
            model = gr.load("models/Qwen/Qwen3-235B-A22B", provider="nebius")
         
     | 
| 22 | 
         
            +
             
     | 
| 23 | 
         
            +
            # Define a wrapper function that injects the system prompt
         
     | 
| 24 | 
         
            +
            def respond(message, chat_history, system_prompt):
         
     | 
| 25 | 
         
            +
                # Prepend the system prompt to the message or handle accordingly
         
     | 
| 26 | 
         
            +
                full_input = f"System: {system_prompt}\nUser: {message}"
         
     | 
| 27 | 
         
            +
                response = model.predict(full_input)  # Adjust depending on how the model expects input
         
     | 
| 28 | 
         
            +
                return response
         
     | 
| 29 | 
         
            +
             
     | 
| 30 | 
         
            +
            # Create a chat interface with a system prompt textbox
         
     | 
| 31 | 
         
            +
            with gr.Blocks(theme=purple_theme) as demo:
         
     | 
| 32 | 
         
            +
                system_prompt = gr.Textbox(value="You are a helpful assistant.", label="System Prompt")
         
     | 
| 33 | 
         
            +
                chatbot = gr.Chatbot()
         
     | 
| 34 | 
         
            +
                interface = gr.ChatInterface(fn=respond, additional_inputs=[system_prompt], chatbot=chatbot)
         
     | 
| 35 | 
         | 
| 36 | 
         
            +
            # Launch
         
     | 
| 37 | 
         
            +
            demo.launch()
         
     | 
| 
         |