celestialli commited on
Commit
e104ed8
1 Parent(s): 0568b88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -56,12 +56,21 @@ def get_chat_answer_request(query, chatbot):
56
  time.sleep(1)
57
 
58
 
 
 
 
 
 
 
59
  css = """
60
  col-container {max-width: 510px; margin-left: auto; margin-right: auto; margin-up: auto; margin-bottom: auto;}
61
  """
62
  with gr.Blocks(css=css) as demo:
63
  with gr.Column(elem_id="col-container"):
64
  with gr.Tab("🧠 模型对话 Dialog"):
 
 
 
65
  chatbot = gr.Chatbot([[None, get_internet_ip()]], show_label=False, elem_id="chatbot")
66
  query = gr.Textbox(show_label=False, placeholder="请输入提问内容,按回车进行提交")
67
  query.submit(get_chat_answer,[query, chatbot], [query, chatbot])
 
56
  time.sleep(1)
57
 
58
 
59
+ def hello(profile: gr.OAuthProfile | None) -> str:
60
+ if profile is None:
61
+ return "I don't know you."
62
+ return f"Hello {profile.name}"
63
+
64
+
65
  css = """
66
  col-container {max-width: 510px; margin-left: auto; margin-right: auto; margin-up: auto; margin-bottom: auto;}
67
  """
68
  with gr.Blocks(css=css) as demo:
69
  with gr.Column(elem_id="col-container"):
70
  with gr.Tab("🧠 模型对话 Dialog"):
71
+ gr.LoginButton()
72
+ gr.LogoutButton()
73
+ gr.Markdown().attach_load_event(hello, None)
74
  chatbot = gr.Chatbot([[None, get_internet_ip()]], show_label=False, elem_id="chatbot")
75
  query = gr.Textbox(show_label=False, placeholder="请输入提问内容,按回车进行提交")
76
  query.submit(get_chat_answer,[query, chatbot], [query, chatbot])