Spaces:
Running
on
Zero
Running
on
Zero
macadeliccc
commited on
Commit
β’
ba9f5b4
1
Parent(s):
29bfd87
test
Browse files
README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
title: Fast OpenChat-3.5
|
3 |
emoji: π
|
4 |
colorFrom: indigo
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.1.2
|
8 |
app_file: app.py
|
|
|
2 |
title: Fast OpenChat-3.5
|
3 |
emoji: π
|
4 |
colorFrom: indigo
|
5 |
+
colorTo: green
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.1.2
|
8 |
app_file: app.py
|
app.py
CHANGED
@@ -46,19 +46,27 @@ def chat_with_ochat(message):
|
|
46 |
except requests.RequestException as e:
|
47 |
return f"Error: {e}"
|
48 |
|
49 |
-
|
|
|
50 |
|
51 |
# Create a Gradio Blocks interface
|
52 |
with gr.Blocks() as app:
|
53 |
-
gr.Markdown("
|
54 |
gr.Markdown("Type your message and get a response from the ochat server.")
|
55 |
with gr.Row():
|
56 |
-
input_text = gr.Textbox(
|
|
|
|
|
|
|
57 |
submit_button = gr.Button("Send")
|
58 |
-
output_text = gr.Textbox(label="ochat Response", interactive=
|
59 |
|
60 |
def update_output(input_message):
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
|
63 |
submit_button.click(fn=update_output, inputs=[input_text], outputs=[output_text])
|
64 |
|
|
|
46 |
except requests.RequestException as e:
|
47 |
return f"Error: {e}"
|
48 |
|
49 |
+
# Chat history variable
|
50 |
+
chat_history = []
|
51 |
|
52 |
# Create a Gradio Blocks interface
|
53 |
with gr.Blocks() as app:
|
54 |
+
gr.Markdown("## vLLM OpenChat-3.5 Interface")
|
55 |
gr.Markdown("Type your message and get a response from the ochat server.")
|
56 |
with gr.Row():
|
57 |
+
input_text = gr.Textbox(
|
58 |
+
label="Your Message",
|
59 |
+
placeholder="Type your message here",
|
60 |
+
)
|
61 |
submit_button = gr.Button("Send")
|
62 |
+
output_text = gr.Textbox(label="ochat Response", interactive=True, scale=4)
|
63 |
|
64 |
def update_output(input_message):
|
65 |
+
global chat_history
|
66 |
+
user_message = f"You: {input_message}"
|
67 |
+
server_response = f"ochat: {chat_with_ochat(input_message)}"
|
68 |
+
chat_history.extend([user_message, server_response])
|
69 |
+
return "\n".join(chat_history)
|
70 |
|
71 |
submit_button.click(fn=update_output, inputs=[input_text], outputs=[output_text])
|
72 |
|