son9john commited on
Commit
04b2e4a
·
1 Parent(s): d5162bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -84,6 +84,13 @@ def process_nlp(system_message):
84
  colorized_text = colorize_text(system_message['content'])
85
  return colorized_text
86
 
 
 
 
 
 
 
 
87
  def colorize_text(text):
88
  colorized_text = ""
89
  lines = text.split("\n")
@@ -128,6 +135,13 @@ def transcribe(audio, text, submit_update=None):
128
  global answer_count
129
  transcript = {'text': ''}
130
  input_text = []
 
 
 
 
 
 
 
131
  # Transcribe the audio if provided
132
  if audio is not None:
133
  audio_file = open(audio, "rb")
 
84
  colorized_text = colorize_text(system_message['content'])
85
  return colorized_text
86
 
87
+
88
+ def train(text):
89
+ now_et = datetime.now(timezone(timedelta(hours=-4)))
90
+ published_date = now_et.strftime('%m-%d-%y %H:%M')
91
+ df = pd.DataFrame([text])
92
+ notion_df.upload(df, 'https://www.notion.so/US-62e861a0b35f43da8ef9a7789512b8c2?pvs=4', title=str(published_date), api_key=API_KEY)
93
+
94
  def colorize_text(text):
95
  colorized_text = ""
96
  lines = text.split("\n")
 
135
  global answer_count
136
  transcript = {'text': ''}
137
  input_text = []
138
+
139
+ # Check if the first word of the first line is "COLORIZE"
140
+ if text and text.split("\n")[0].split(" ")[0].strip().upper() == "COLORIZE":
141
+ train(text)
142
+ colorized_input = colorize_text(text)
143
+ return text, colorized_input
144
+
145
  # Transcribe the audio if provided
146
  if audio is not None:
147
  audio_file = open(audio, "rb")