Spaces:
Runtime error
Runtime error
vericudebuget
commited on
Commit
•
bf9797c
1
Parent(s):
0c6b245
Update app.py
Browse files
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:
|
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.
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
)
|
|
|
|
|
|
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)
|