Spaces:
Build error
Build error
Commit
·
a377469
1
Parent(s):
02ccde5
calendar_reader and gmail_sender files is updated
Browse files- .gitattributes +4 -0
- .gitignore +2 -0
- .gradio/flagged/dataset1.csv +33 -0
- README.md +19 -0
- app.py +14 -26
- requirements.txt +16 -4
- token.json +0 -1
- {utils → tools}/__pycache__/calendar_reader.cpython-310.pyc +0 -0
- tools/__pycache__/gmail_sender.cpython-310.pyc +0 -0
- tools/__pycache__/planner.cpython-310.pyc +0 -0
- {utils → tools}/calendar_reader.py +8 -2
- {utils → tools}/gmail_sender.py +11 -1
- {utils → tools}/planner.py +6 -2
- utils/__pycache__/gmail_sender.cpython-310.pyc +0 -0
- utils/__pycache__/planner.cpython-310.pyc +0 -0
- utils/tools.py +0 -8
.gitattributes
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
.gitattributes dosyası, Git depolarında belirli dosya türlerine özel davranışlar tanımlamak için kullanılır.
|
| 3 |
+
Bu dosya sayesinde, Git'e dosyaları nasıl ele alması gerektiğini bildirebilirsiniz.
|
| 4 |
+
"""
|
| 5 |
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 6 |
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 7 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
data/token.json
|
| 2 |
+
data/
|
.gradio/flagged/dataset1.csv
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
E-posta Adresi,Günlük Plan,timestamp
|
| 2 |
+
alcmdrn7@gmail.com,"📚 Ders Programı:
|
| 3 |
+
- 09:00-09:40 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 4 |
+
- 09:50-10:30 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 5 |
+
- 10:40-11:20 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 6 |
+
- 11:30-12:10 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 7 |
+
|
| 8 |
+
🗓️ Takvim Etkinlikleri:
|
| 9 |
+
Bugün etkinlik yok.",2025-05-05 19:48:31.039123
|
| 10 |
+
alcmdrn7@gmail.com,"📚 Ders Programı:
|
| 11 |
+
- 09:00-09:40 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 12 |
+
- 09:50-10:30 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 13 |
+
- 10:40-11:20 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 14 |
+
- 11:30-12:10 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 15 |
+
|
| 16 |
+
🗓️ Takvim Etkinlikleri:
|
| 17 |
+
Bugün etkinlik yok.",2025-05-05 19:49:44.311093
|
| 18 |
+
onculeresra76@gmail.com,"📚 Ders Programı:
|
| 19 |
+
- 09:00-09:40 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 20 |
+
- 09:50-10:30 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 21 |
+
- 10:40-11:20 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 22 |
+
- 11:30-12:10 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 23 |
+
|
| 24 |
+
🗓️ Takvim Etkinlikleri:
|
| 25 |
+
Bugün etkinlik yok.",2025-05-05 19:50:01.592029
|
| 26 |
+
onculeresra76@gmail.com,"📚 Ders Programı:
|
| 27 |
+
- 09:00-09:40 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 28 |
+
- 09:50-10:30 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 29 |
+
- 10:40-11:20 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 30 |
+
- 11:30-12:10 | PYTHON PROGRAMMING FOR ARTIFICIAL INTELLIGENCE | A BLOK MF203 | Doç. Dr. FARUK SERİN
|
| 31 |
+
|
| 32 |
+
🗓️ Takvim Etkinlikleri:
|
| 33 |
+
Bugün etkinlik yok.",2025-05-05 19:50:11.634280
|
README.md
CHANGED
|
@@ -11,3 +11,22 @@ short_description: Day planning Agent
|
|
| 11 |
---
|
| 12 |
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 14 |
+
|
| 15 |
+
Daily-Plan-Agent/
|
| 16 |
+
│
|
| 17 |
+
├── data/
|
| 18 |
+
│ └── credentials.json
|
| 19 |
+
│ └── token.json
|
| 20 |
+
│ └── class_schedule.json
|
| 21 |
+
│
|
| 22 |
+
├── tools/
|
| 23 |
+
│ ├── planner.py # Ders + takvimden günlük plan üretimi
|
| 24 |
+
│ ├── gmail_sender.py # Planı mail olarak gönderme
|
| 25 |
+
│ └── calendar_reader.py # Google Calendar etkinlik okuma
|
| 26 |
+
│
|
| 27 |
+
├── .gitattributes
|
| 28 |
+
├── .gitignore # Hari. tutulacak dosyalar
|
| 29 |
+
├── app.py # Gradio + SmolAgent entrypoint
|
| 30 |
+
├── README.md
|
| 31 |
+
├── requirements.txt #Proje paketleri
|
| 32 |
+
|
app.py
CHANGED
|
@@ -1,30 +1,18 @@
|
|
| 1 |
-
|
| 2 |
-
from
|
| 3 |
-
from
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
send_email("
|
| 8 |
-
|
| 9 |
-
# app.py
|
| 10 |
-
from smol_developer import SmolAgent, Tool
|
| 11 |
-
from tools import generate_day_plan_tool
|
| 12 |
-
|
| 13 |
-
tools = [
|
| 14 |
-
Tool(
|
| 15 |
-
name="generate_day_plan_tool",
|
| 16 |
-
func=generate_day_plan_tool,
|
| 17 |
-
description="Kullanıcının günlük takvimine ve derslerine göre bir gün planı hazırlar"
|
| 18 |
-
)
|
| 19 |
-
]
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
if __name__ == "__main__":
|
| 24 |
-
|
| 25 |
-
while True:
|
| 26 |
-
user_input = input("👤: ")
|
| 27 |
-
if user_input.lower() in ["exit", "quit"]:
|
| 28 |
-
break
|
| 29 |
-
response = agent.run(user_input)
|
| 30 |
-
print(f"\n🤖: {response}\n")
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from tools.planner import generate_daily_plan
|
| 3 |
+
from tools.gmail_sender import send_email
|
| 4 |
|
| 5 |
+
def generate_plan_and_send_email(email):
|
| 6 |
+
plan = generate_daily_plan()
|
| 7 |
+
send_email("Bugün için Plan", plan, email)
|
| 8 |
+
return plan
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
iface = gr.Interface(
|
| 11 |
+
fn=generate_plan_and_send_email,
|
| 12 |
+
inputs=gr.Textbox(label="E-posta Adresi"),
|
| 13 |
+
outputs=gr.Textbox(label="Günlük Plan"),
|
| 14 |
+
live=True
|
| 15 |
+
)
|
| 16 |
|
| 17 |
if __name__ == "__main__":
|
| 18 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,10 +1,22 @@
|
|
| 1 |
-
smolagents
|
| 2 |
openai
|
| 3 |
-
google-api-python-client
|
| 4 |
google-auth-httplib2
|
| 5 |
-
google-auth-oauthlib
|
| 6 |
-
pytz
|
| 7 |
python-dotenv
|
| 8 |
smol-developer
|
| 9 |
google-auth
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
smolagents~=1.13.0
|
| 2 |
openai
|
| 3 |
+
google-api-python-client~=2.169.0
|
| 4 |
google-auth-httplib2
|
| 5 |
+
google-auth-oauthlib~=1.2.2
|
| 6 |
+
pytz~=2025.2
|
| 7 |
python-dotenv
|
| 8 |
smol-developer
|
| 9 |
google-auth
|
| 10 |
|
| 11 |
+
|
| 12 |
+
protobuf~=6.30.2
|
| 13 |
+
smoltools~=1.0.14
|
| 14 |
+
pyyaml~=6.0.2
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
gradio
|
| 18 |
+
smolagents
|
| 19 |
+
google-auth
|
| 20 |
+
google-auth-oauthlib
|
| 21 |
+
google-auth-httplib2
|
| 22 |
+
google-api-python-client
|
token.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"token": "ya29.a0AZYkNZgwa6llRWqFaYYkMU3GIQpyYfnYbGPV6dduSZlc9z5YfF3ZLzB0Ad6dOULx0C49-ygfuncdGg574ZK9QYUEfPHonZoHr7ASY-flAaCcO1nk08sRF_zIr6Lbrr67VRdQ588oGLU2bC93ckGXB5XAQ-9cUONan72hoyOAaCgYKAdISARESFQHGX2Mi3po9y6w5fT2iVBxrlvNsjg0175", "refresh_token": "1//03UmRXrJcBBG_CgYIARAAGAMSNwF-L9IrFPorqxuyHu67HVI-wNvWnSPBCtU-DWsVNyFFJ95tRCa3rcjb3kUTB4brv-md-hYmpx8", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "604824766950-h21v561mq16ek0ha94ic7jon21mn67ic.apps.googleusercontent.com", "client_secret": "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", "scopes": ["https://www.googleapis.com/auth/calendar.readonly"], "universe_domain": "googleapis.com", "account": "", "expiry": "2025-05-03T13:54:42.681896Z"}
|
|
|
|
|
|
{utils → tools}/__pycache__/calendar_reader.cpython-310.pyc
RENAMED
|
Binary files a/utils/__pycache__/calendar_reader.cpython-310.pyc and b/tools/__pycache__/calendar_reader.cpython-310.pyc differ
|
|
|
tools/__pycache__/gmail_sender.cpython-310.pyc
ADDED
|
Binary file (1.27 kB). View file
|
|
|
tools/__pycache__/planner.cpython-310.pyc
ADDED
|
Binary file (1.08 kB). View file
|
|
|
{utils → tools}/calendar_reader.py
RENAMED
|
@@ -2,9 +2,15 @@ from google.oauth2.credentials import Credentials
|
|
| 2 |
from googleapiclient.discovery import build
|
| 3 |
import datetime
|
| 4 |
import pytz
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
service = build('calendar', 'v3', credentials=creds)
|
| 9 |
|
| 10 |
now = datetime.datetime.now(pytz.timezone("Europe/Istanbul"))
|
|
|
|
| 2 |
from googleapiclient.discovery import build
|
| 3 |
import datetime
|
| 4 |
import pytz
|
| 5 |
+
from smolagents import tool
|
| 6 |
|
| 7 |
+
@tool
|
| 8 |
+
def get_todays_events() -> list[str]:
|
| 9 |
+
"""
|
| 10 |
+
Get today's events from Google Calendar in formatted string form.
|
| 11 |
+
Returns a list of event descriptions for the current day.
|
| 12 |
+
"""
|
| 13 |
+
creds = Credentials.from_authorized_user_file('data/token.json',['https://www.googleapis.com/auth/calendar.readonly'])
|
| 14 |
service = build('calendar', 'v3', credentials=creds)
|
| 15 |
|
| 16 |
now = datetime.datetime.now(pytz.timezone("Europe/Istanbul"))
|
{utils → tools}/gmail_sender.py
RENAMED
|
@@ -1,8 +1,18 @@
|
|
| 1 |
import smtplib
|
| 2 |
from email.mime.text import MIMEText
|
| 3 |
from email.mime.multipart import MIMEMultipart
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
from_email = "alcmdrn7@gmail.com"
|
| 7 |
password = "mgse lffk thsu hbxs"
|
| 8 |
|
|
|
|
| 1 |
import smtplib
|
| 2 |
from email.mime.text import MIMEText
|
| 3 |
from email.mime.multipart import MIMEMultipart
|
| 4 |
+
from smolagents import tool
|
| 5 |
|
| 6 |
+
@tool
|
| 7 |
+
def send_email(subject: str, body: str, to_email: str) -> None:
|
| 8 |
+
"""
|
| 9 |
+
Send an email with a given subject and body to the specified address.
|
| 10 |
+
|
| 11 |
+
Args:
|
| 12 |
+
subject (str): The subject of the email.
|
| 13 |
+
body (str): The plain text content of the email.
|
| 14 |
+
to_email (str): The recipient's email address.
|
| 15 |
+
"""
|
| 16 |
from_email = "alcmdrn7@gmail.com"
|
| 17 |
password = "mgse lffk thsu hbxs"
|
| 18 |
|
{utils → tools}/planner.py
RENAMED
|
@@ -1,8 +1,12 @@
|
|
| 1 |
-
from
|
| 2 |
import json
|
| 3 |
import datetime
|
| 4 |
|
| 5 |
-
def generate_daily_plan():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# 1. Ders programını oku
|
| 7 |
with open("data/class_schedule.json", "r", encoding="utf-8") as f:
|
| 8 |
class_schedule = json.load(f)
|
|
|
|
| 1 |
+
from tools.calendar_reader import get_todays_events
|
| 2 |
import json
|
| 3 |
import datetime
|
| 4 |
|
| 5 |
+
def generate_daily_plan() -> str:
|
| 6 |
+
"""
|
| 7 |
+
Generate a daily plan based on class schedule and today's calendar events.
|
| 8 |
+
Returns a formatted plan string.
|
| 9 |
+
"""
|
| 10 |
# 1. Ders programını oku
|
| 11 |
with open("data/class_schedule.json", "r", encoding="utf-8") as f:
|
| 12 |
class_schedule = json.load(f)
|
utils/__pycache__/gmail_sender.cpython-310.pyc
DELETED
|
Binary file (901 Bytes)
|
|
|
utils/__pycache__/planner.cpython-310.pyc
DELETED
|
Binary file (926 Bytes)
|
|
|
utils/tools.py
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
# tools.py
|
| 2 |
-
from utils.planner import generate_daily_plan
|
| 3 |
-
|
| 4 |
-
def generate_day_plan_tool(input: str) -> str:
|
| 5 |
-
"""
|
| 6 |
-
Kullanıcının gününü planlar ve sade bir metin döner.
|
| 7 |
-
"""
|
| 8 |
-
return generate_daily_plan()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|