vericudebuget commited on
Commit
bf9797c
1 Parent(s): 0c6b245

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -28,7 +28,7 @@ def generate(prompt, history, system_prompt, temperature=0.9, max_new_tokens=904
28
  # Get current time
29
  now = datetime.datetime.now()
30
  formatted_time = now.strftime("%H:%M:%S, %B %d, %Y")
31
- system_prompt = f"System time: (UTC+1 {formatted_time})"
32
 
33
  formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
34
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
@@ -45,16 +45,18 @@ additional_inputs = [
45
  gr.Slider(label="Repetition penalty", value=1.2, minimum=1.0, maximum=2.0, step=0.05, interactive=True, info="Penalize repeated tokens")
46
  ]
47
 
48
- gr.ChatInterface(
49
- fn=generate,
50
- chatbot=gr.Chatbot(show_label=True, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
51
- additional_inputs=additional_inputs,
52
- title="ConvoLite",
53
- submit_btn="➢",
54
- retry_btn="Retry",
55
- undo_btn="↩ Undo",
56
- clear_btn="Clear (new chat)",
57
- stop_btn="Stop ▢",
58
- submin_btn, min_width = "50px",
59
- concurrency_limit=100,
60
- ).launch(show_api=False)
 
 
 
28
  # Get current time
29
  now = datetime.datetime.now()
30
  formatted_time = now.strftime("%H:%M:%S, %B %d, %Y")
31
+ system_prompt = f"System time: {formatted_time}"
32
 
33
  formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
34
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
 
45
  gr.Slider(label="Repetition penalty", value=1.2, minimum=1.0, maximum=2.0, step=0.05, interactive=True, info="Penalize repeated tokens")
46
  ]
47
 
48
+ with gr.Blocks() as demo:
49
+ chatbot = gr.Chatbot(show_label=True, show_share_button=False, show_copy_button=True, likeable=True, layout="panel")
50
+ with gr.Row():
51
+ with gr.Column(scale=3):
52
+ user_input = gr.Textbox(label="Your message", placeholder="Type your message here...")
53
+ with gr.Column(scale=1, height=40):
54
+ submit_button = gr.Button("", shape="square")
55
+
56
+ submit_button.click(
57
+ fn=generate,
58
+ inputs=[user_input, chatbot, gr.Textbox(label="System Prompt", max_lines=1, interactive=True)],
59
+ outputs=chatbot
60
+ )
61
+
62
+ demo.launch(show_api=False)