faizah2512 commited on
Commit
838c6ac
·
verified ·
1 Parent(s): 2e443bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -6
app.py CHANGED
@@ -35,10 +35,27 @@ def respond(
35
  response += token
36
  yield response
37
 
38
- demo = gr.ChatInterface(
39
- respond,
40
- theme='freddyaboulton/dracula_revamped'
41
- )
42
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  if __name__ == "__main__":
44
- demo.launch()
 
 
35
  response += token
36
  yield response
37
 
38
+ # Create a custom function for the theme and interface
39
+ def create_interface():
40
+ with gr.Blocks(theme='HaleyCH/HaleyCH_Theme') as demo:
41
+ with gr.Row():
42
+ with gr.Column():
43
+ # Inputs for system message, max tokens, temperature, top_p
44
+ system_message = gr.Textbox(value="You are a friendly Chatbot.", label="System message")
45
+ max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens")
46
+ temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
47
+ top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
48
+
49
+ # Chat Interface
50
+ chat = gr.ChatInterface(
51
+ fn=respond,
52
+ inputs=[system_message, max_tokens, temperature, top_p],
53
+ theme='HaleyCH/HaleyCH_Theme'
54
+ )
55
+
56
+ return demo
57
+
58
+ # Launch the Gradio app
59
  if __name__ == "__main__":
60
+ interface = create_interface()
61
+ interface.launch()