ffreemt commited on
Commit
407dc77
1 Parent(s): 7c0ecdf

Add pendulum

Browse files
Files changed (2) hide show
  1. app.py +4 -3
  2. requirements.txt +2 -1
app.py CHANGED
@@ -2,10 +2,10 @@
2
  # pylint: disable=invalid-name, line-too-long,broad-exception-caught, protected-access
3
  import os
4
  import time
5
- from datetime import datetime
6
  from pathlib import Path
7
 
8
  import gradio as gr
 
9
  import torch
10
  from loguru import logger
11
  from transformers import AutoModel, AutoTokenizer
@@ -67,7 +67,8 @@ if model_cache_path:
67
  logger.info(f"{model_name=} {model_size_gb=:.2f} GB")
68
 
69
  def get_time():
70
- return datetime.now().time()
 
71
 
72
  def respond(message, chat_history):
73
  """Gen a response."""
@@ -95,7 +96,7 @@ with gr.Blocks(theme=theme) as block:
95
  btn = gr.Button("Send")
96
  with gr.Column(scale=1, min_width=8):
97
  clear = gr.ClearButton([msg, chatbot])
98
- with gr.Column(scale=1, min_width=8):
99
  dt = gr.Textbox(label="Current time")
100
  # do not clear prompt
101
  msg.submit(respond, [msg, chatbot], [msg, chatbot])
 
2
  # pylint: disable=invalid-name, line-too-long,broad-exception-caught, protected-access
3
  import os
4
  import time
 
5
  from pathlib import Path
6
 
7
  import gradio as gr
8
+ import pendulum
9
  import torch
10
  from loguru import logger
11
  from transformers import AutoModel, AutoTokenizer
 
67
  logger.info(f"{model_name=} {model_size_gb=:.2f} GB")
68
 
69
  def get_time():
70
+ # return datetime.now().time()
71
+ return pendulum.now().format('HH:mm:ss zz')
72
 
73
  def respond(message, chat_history):
74
  """Gen a response."""
 
96
  btn = gr.Button("Send")
97
  with gr.Column(scale=1, min_width=8):
98
  clear = gr.ClearButton([msg, chatbot])
99
+ with gr.Column(scale=1, min_width=25):
100
  dt = gr.Textbox(label="Current time")
101
  # do not clear prompt
102
  msg.submit(respond, [msg, chatbot], [msg, chatbot])
requirements.txt CHANGED
@@ -5,4 +5,5 @@ cpm_kernels
5
  # accelerate
6
  # bitsandbytes
7
 
8
- loguru
 
 
5
  # accelerate
6
  # bitsandbytes
7
 
8
+ loguru
9
+ pendulum