macadeliccc commited on
Commit
ba9f5b4
β€’
1 Parent(s): 29bfd87
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +13 -5
README.md CHANGED
@@ -2,7 +2,7 @@
2
  title: Fast OpenChat-3.5
3
  emoji: 🌍
4
  colorFrom: indigo
5
- colorTo: blue
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("### ochat Chat Interface")
54
  gr.Markdown("Type your message and get a response from the ochat server.")
55
  with gr.Row():
56
- input_text = gr.Textbox(label="Your Message")
 
 
 
57
  submit_button = gr.Button("Send")
58
- output_text = gr.Textbox(label="ochat Response", interactive=False)
59
 
60
  def update_output(input_message):
61
- return chat_with_ochat(input_message)
 
 
 
 
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