Felguk commited on
Commit
85e3f0b
·
verified ·
1 Parent(s): b8a94a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
 
3
- # Custom purple theme with Montserrat font
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
- # Create the interface with the theme
21
- interface = gr.load(
22
- "models/Qwen/Qwen3-235B-A22B",
23
- provider="nebius"
24
- )
 
 
 
 
 
 
 
 
 
 
25
 
26
- # Set the theme before launching
27
- interface.theme = purple_theme
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()