son9john commited on
Commit
9df5b77
·
1 Parent(s): 3a00e21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -78,11 +78,26 @@ def colorize_and_update(system_message, submit_update):
78
  def update_text_output(system_message, submit_update):
79
  submit_update(system_message['content'], None)
80
 
 
 
 
 
 
 
 
 
81
  def transcribe(audio, text, submit_update=None):
82
  global messages
83
  global answer_count
84
  transcript = {'text': ''}
85
  input_text = []
 
 
 
 
 
 
 
86
  # Transcribe the audio if provided
87
  if audio is not None:
88
  audio_file = open(audio, "rb")
 
78
  def update_text_output(system_message, submit_update):
79
  submit_update(system_message['content'], None)
80
 
81
+
82
+ def train(text):
83
+ now_et = datetime.now(timezone(timedelta(hours=-4)))
84
+ published_date = now_et.strftime('%m-%d-%y %H:%M')
85
+ df = pd.DataFrame([text])
86
+ notion_df.upload(df, 'https://www.notion.so/US-62e861a0b35f43da8ef9a7789512b8c2?pvs=4', title=str(published_date), api_key=API_KEY)
87
+
88
+
89
  def transcribe(audio, text, submit_update=None):
90
  global messages
91
  global answer_count
92
  transcript = {'text': ''}
93
  input_text = []
94
+
95
+ # Check if the first word of the first line is "COLORIZE"
96
+ if text and text.split("\n")[0].split(" ")[0].strip().upper() == "COLORIZE":
97
+ train(text)
98
+ colorized_input = colorize_text(text)
99
+ return text, colorized_input
100
+
101
  # Transcribe the audio if provided
102
  if audio is not None:
103
  audio_file = open(audio, "rb")