zanegraper commited on
Commit
99d880b
·
1 Parent(s): 5ecd59e
Files changed (1) hide show
  1. app.py +15 -18
app.py CHANGED
@@ -1,5 +1,3 @@
1
- # app.py
2
-
3
  import gradio as gr
4
  import pandas as pd
5
  import tempfile
@@ -7,9 +5,7 @@ from combined_email_finder import get_combined_emails
7
 
8
  def extract_emails(domain):
9
  emails = get_combined_emails(domain)
10
- if emails:
11
- return "\n".join(emails)
12
- return "⚠️ No valid emails found."
13
 
14
  def export_csv(domain):
15
  emails = get_combined_emails(domain)
@@ -20,18 +16,19 @@ def export_csv(domain):
20
  df.to_csv(tmp.name, index=False)
21
  return tmp.name
22
 
23
- iface = gr.Interface(
24
- fn=extract_emails,
25
- inputs=gr.Textbox(label="🌐 Enter Domain (e.g. example.com)", placeholder="example.com"),
26
- outputs=[
27
- gr.Textbox(label="📧 Extracted Emails", lines=10),
28
- gr.File(label="📥 Download CSV")
29
- ],
30
- title="AI-Powered EmailFinder",
31
- description="Finds emails using webpage crawling and search engines via EmailFinder."
32
- )
33
 
34
- # Add a second function call for the CSV generator
35
- iface.add_component("📥 Download Emails as CSV", export_csv)
 
 
 
 
36
 
37
- iface.launch()
 
 
 
1
  import gradio as gr
2
  import pandas as pd
3
  import tempfile
 
5
 
6
  def extract_emails(domain):
7
  emails = get_combined_emails(domain)
8
+ return "\n".join(emails) if emails else "⚠️ No valid emails found."
 
 
9
 
10
  def export_csv(domain):
11
  emails = get_combined_emails(domain)
 
16
  df.to_csv(tmp.name, index=False)
17
  return tmp.name
18
 
19
+ with gr.TabbedInterface(["Extract Emails", "Download CSV"]) as demo:
20
+ with gr.Tab("Extract Emails"):
21
+ gr.Interface(
22
+ fn=extract_emails,
23
+ inputs=gr.Textbox(label="Enter Domain"),
24
+ outputs=gr.Textbox(label="Extracted Emails", lines=10)
25
+ )
 
 
 
26
 
27
+ with gr.Tab("Download CSV"):
28
+ gr.Interface(
29
+ fn=export_csv,
30
+ inputs=gr.Textbox(label="Enter Domain Again"),
31
+ outputs=gr.File(label="Download CSV")
32
+ )
33
 
34
+ demo.launch()