nvymshr commited on
Commit
ce188a8
·
verified ·
1 Parent(s): 6785fa3

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -71
app.py DELETED
@@ -1,71 +0,0 @@
1
- import gradio as gr
2
- import pandas as pd
3
- import requests
4
- from bs4 import BeautifulSoup
5
- import os
6
-
7
- def scrape_rfps():
8
- """Scrape RFP data from public sources"""
9
- rfp_list = []
10
-
11
- # Example: UNGM (United Nations Global Marketplace)
12
- url = "https://www.ungm.org/Public/Notice"
13
- headers = {"User-Agent": "Mozilla/5.0"}
14
- response = requests.get(url, headers=headers)
15
-
16
- if response.status_code == 200:
17
- soup = BeautifulSoup(response.text, "html.parser")
18
- rfps = soup.find_all("tr", class_="dataRow")
19
-
20
- for rfp in rfps[:10]: # Limit to 10 results for speed
21
- title = rfp.find("td", class_="titleColumn").text.strip()
22
- deadline = rfp.find("td", class_="deadlineColumn").text.strip()
23
- budget = "N/A" # Not available in UNGM
24
- geography = "Global" # UNGM is global
25
- funder = "United Nations"
26
- partner = "N/A"
27
- summary = "N/A"
28
- link = "https://www.ungm.org" + rfp.find("a")["href"]
29
-
30
- rfp_list.append([title, deadline, budget, geography, funder, partner, summary, link])
31
-
32
- return rfp_list
33
-
34
- def display_rfps():
35
- """Fetch RFPs and display them in a table."""
36
- data = scrape_rfps()
37
- df = pd.DataFrame(data, columns=["Title", "Deadline", "Budget", "Geography", "Funder", "Partner", "Summary", "Link"])
38
- return df
39
-
40
- todo_list = []
41
-
42
- def add_to_todo(title, deadline, budget, geography, funder, partner, summary, link):
43
- """Add an RFP to the To-Do List."""
44
- todo_list.append([title, deadline, budget, geography, funder, partner, summary, link])
45
- return f"Added: {title} to To-Do List"
46
-
47
- def export_to_excel():
48
- """Export To-Do List as an Excel File."""
49
- df = pd.DataFrame(todo_list, columns=["Title", "Deadline", "Budget", "Geography", "Funder", "Partner", "Summary", "Link"])
50
- file_path = "rfp_todo_list.xlsx"
51
- df.to_excel(file_path, index=False)
52
- return file_path
53
-
54
- # Gradio UI
55
- def rfp_interface():
56
- rfps_df = display_rfps()
57
- return rfps_df
58
-
59
- title_input = gr.Textbox(label="Title")
60
- delete_button = gr.Button("Export To-Do List")
61
-
62
- gui = gr.Interface(
63
- fn=rfp_interface,
64
- inputs=[],
65
- outputs=gr.Dataframe(headers=["Title", "Deadline", "Budget", "Geography", "Funder", "Partner", "Summary", "Link"]),
66
- live=True,
67
- title="RFP Scraper & Tracker",
68
- description="Fetch and manage RFP opportunities dynamically."
69
- )
70
-
71
- gui.launch(share=True)