asuhag commited on
Commit
36e6577
1 Parent(s): f1c4868

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -2,19 +2,24 @@ import openai
2
  import gradio as gr
3
  from openai import OpenAI
4
  import os
5
- from datetime import datetime
 
6
 
7
  openai_api_key = os.getenv("OPENAI_API_KEY")
8
 
9
  client = OpenAI(api_key=openai_api_key)
10
 
 
 
11
  def predict(input, _):
 
 
12
  response = client.chat.completions.create(
13
  model="gpt-3.5-turbo",
14
  messages=[
15
  {
16
  "role": "system",
17
- "content": f"""Today's date and time is {datetime.now()}. A text will be passed to you. Extract date and time from it. Output the date and time in the format YYYY-MM-DD hour:minutes.
18
 
19
  If multiple date times are available, extract all dates and time from the text as a list data type and output them in the format YYYY-MM-DD hour:minutes.
20
 
 
2
  import gradio as gr
3
  from openai import OpenAI
4
  import os
5
+ from datetime import datetime, date
6
+ import calendar
7
 
8
  openai_api_key = os.getenv("OPENAI_API_KEY")
9
 
10
  client = OpenAI(api_key=openai_api_key)
11
 
12
+
13
+
14
  def predict(input, _):
15
+
16
+
17
  response = client.chat.completions.create(
18
  model="gpt-3.5-turbo",
19
  messages=[
20
  {
21
  "role": "system",
22
+ "content": f"""Today's day, date and time is {calendar.day_name[date.today().weekday()], datetime.now()}. A text will be passed to you. Extract date and time from it. Output the date and time in the format YYYY-MM-DD hour:minutes.
23
 
24
  If multiple date times are available, extract all dates and time from the text as a list data type and output them in the format YYYY-MM-DD hour:minutes.
25