TA commited on
Commit
4befa4d
1 Parent(s): f35ec94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -56,8 +56,8 @@ def predict_beta(message, chatbot=[], system_prompt=""):
56
  error_msg = f"Failed to decode response as JSON: {str(e)}"
57
  raise gr.Error(error_msg)
58
 
59
- def test_preview_chatbot(message, history):
60
- response = predict_beta(message, history, SYSTEM_PROMPT)
61
  text_start = response.rfind("", ) + len("")
62
  response = response[text_start:]
63
  return response
@@ -68,9 +68,5 @@ Expand your imagination and broaden your horizons with LLM. Welcome to **{TITLE}
68
  "{EXAMPLE_INPUT}"
69
  """
70
 
71
- chatbot_preview = gr.Chatbot(layout="panel", value=[(None, welcome_preview_message)])
72
- textbox_preview = gr.Textbox(scale=7, container=False, value=EXAMPLE_INPUT)
73
-
74
- demo = gr.Interface(fn=test_preview_chatbot, inputs=textbox_preview, outputs=chatbot_preview)
75
- demo.launch(share=True)
76
-
 
56
  error_msg = f"Failed to decode response as JSON: {str(e)}"
57
  raise gr.Error(error_msg)
58
 
59
+ def chat_interface(message, chat_history):
60
+ response = predict_beta(message, chat_history, SYSTEM_PROMPT)
61
  text_start = response.rfind("", ) + len("")
62
  response = response[text_start:]
63
  return response
 
68
  "{EXAMPLE_INPUT}"
69
  """
70
 
71
+ chatbot_preview = gr.ChatBot(chat_interface, title=TITLE, system_message=welcome_preview_message)
72
+ chatbot_preview.launch()