fvde commited on
Commit
b2ecf83
·
1 Parent(s): c77919f

Upload folder using huggingface_hub

Browse files
src/__pycache__/gradio_app.cpython-311.pyc CHANGED
Binary files a/src/__pycache__/gradio_app.cpython-311.pyc and b/src/__pycache__/gradio_app.cpython-311.pyc differ
 
src/__pycache__/mailing.cpython-311.pyc CHANGED
Binary files a/src/__pycache__/mailing.cpython-311.pyc and b/src/__pycache__/mailing.cpython-311.pyc differ
 
src/gradio_app.py CHANGED
@@ -66,6 +66,10 @@ def switch_buttons(interactive: bool):
66
  )
67
 
68
 
 
 
 
 
69
  def load_summary_section(llm: ChatOpenAI):
70
  """Load the summary section
71
 
@@ -112,14 +116,14 @@ def load_summary_section(llm: ChatOpenAI):
112
 
113
  with gr.Row().style(equal_height=True):
114
  with gr.Column(scale=1):
115
- recipiant_email_summary = gr.Textbox(
116
  label="Recipient Email", placeholder="Enter Email"
117
  )
118
  subject_email_summary = gr.Textbox(
119
  label="Subject", placeholder="Enter Subject"
120
  )
121
  send_email_button = gr.Button(
122
- "TEST email", link="mailto:", interactive=False
123
  )
124
  with gr.Column(scale=3):
125
  email_instructions_summary = gr.Textbox(
@@ -153,6 +157,11 @@ def load_summary_section(llm: ChatOpenAI):
153
  [file_upload_summary, summary_sections_dropdown, gr.State([llm])],
154
  [summary_output],
155
  queue=False,
 
 
 
 
 
156
  ).then(
157
  switch_buttons,
158
  [gr.State(True)],
@@ -168,7 +177,7 @@ def load_summary_section(llm: ChatOpenAI):
168
  ).then(
169
  lambda: None, None, email_instructions_summary, queue=False
170
  ).then(
171
- lambda: None, None, recipiant_email_summary, queue=False
172
  )
173
 
174
  # Email button click opens the default email client and fills in the email instructions
 
66
  )
67
 
68
 
69
+ def update_email_url(address: str, subject: str, body: str):
70
+ return gr.update(link=f"mailto:{address}?subject={subject}&body={body}")
71
+
72
+
73
  def load_summary_section(llm: ChatOpenAI):
74
  """Load the summary section
75
 
 
116
 
117
  with gr.Row().style(equal_height=True):
118
  with gr.Column(scale=1):
119
+ recipient_email_summary = gr.Textbox(
120
  label="Recipient Email", placeholder="Enter Email"
121
  )
122
  subject_email_summary = gr.Textbox(
123
  label="Subject", placeholder="Enter Subject"
124
  )
125
  send_email_button = gr.Button(
126
+ "TEST email", link="mailto:", interactive=False, variant="primary"
127
  )
128
  with gr.Column(scale=3):
129
  email_instructions_summary = gr.Textbox(
 
157
  [file_upload_summary, summary_sections_dropdown, gr.State([llm])],
158
  [summary_output],
159
  queue=False,
160
+ ).then(
161
+ fn=update_email_url,
162
+ inputs=[recipient_email_summary, subject_email_summary, summary_output],
163
+ outputs=[send_email_button],
164
+ queue=False,
165
  ).then(
166
  switch_buttons,
167
  [gr.State(True)],
 
177
  ).then(
178
  lambda: None, None, email_instructions_summary, queue=False
179
  ).then(
180
+ lambda: None, None, recipient_email_summary, queue=False
181
  )
182
 
183
  # Email button click opens the default email client and fills in the email instructions
src/mailing.py CHANGED
@@ -33,14 +33,6 @@ def send_email(
33
 
34
  # Construct the mailto URL
35
  mailto_url = f"mailto:{email_addresses}?subject={subject}&body={email_content}"
36
- print(webbrowser)
37
- print("SUCESS TO HERE")
38
- # Open the default email client
39
- output = webbrowser.open(mailto_url, new=1)
40
- import subprocess
41
- import sys
42
-
43
- print(sys.platform[:3])
44
- # breakpoint()
45
 
46
- print(output)
 
 
33
 
34
  # Construct the mailto URL
35
  mailto_url = f"mailto:{email_addresses}?subject={subject}&body={email_content}"
 
 
 
 
 
 
 
 
 
36
 
37
+ # Open the default email client
38
+ webbrowser.open(mailto_url, new=2)