Spaces:
Sleeping
Sleeping
Update excel_chat.py
Browse files- excel_chat.py +86 -1
excel_chat.py
CHANGED
|
@@ -5,6 +5,20 @@ import os
|
|
| 5 |
import pandas as pd
|
| 6 |
import numpy as np
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def chat_with_mistral(source_cols, dest_col, prompt, tdoc_name, excel_file, url):
|
| 9 |
|
| 10 |
df = pd.read_excel(excel_file)
|
|
@@ -56,4 +70,75 @@ def get_columns(file):
|
|
| 56 |
columns = list(df.columns)
|
| 57 |
return gr.update(choices=columns), gr.update(choices=columns), gr.update(choices=columns), gr.update(choices=columns + [""]), df.head(5)
|
| 58 |
else:
|
| 59 |
-
return gr.update(choices=[]), gr.update(choices=[]), gr.update(choices=[]), gr.update(choices=[]), pd.DataFrame()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
import numpy as np
|
| 7 |
|
| 8 |
+
|
| 9 |
+
def browse_folder(url):
|
| 10 |
+
if url.lower().endswith(('docs', 'docs/')):
|
| 11 |
+
return gr.update(choices=[])
|
| 12 |
+
response = requests.get(url)
|
| 13 |
+
response.raise_for_status() # This will raise an exception if there's an error
|
| 14 |
+
|
| 15 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
| 16 |
+
|
| 17 |
+
excel_links = [a['href'] + '/' for a in soup.find_all('a', href=True) if a['href'].startswith(url)]
|
| 18 |
+
|
| 19 |
+
return gr.update(choices=excel_links)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
def chat_with_mistral(source_cols, dest_col, prompt, tdoc_name, excel_file, url):
|
| 23 |
|
| 24 |
df = pd.read_excel(excel_file)
|
|
|
|
| 70 |
columns = list(df.columns)
|
| 71 |
return gr.update(choices=columns), gr.update(choices=columns), gr.update(choices=columns), gr.update(choices=columns + [""]), df.head(5)
|
| 72 |
else:
|
| 73 |
+
return gr.update(choices=[]), gr.update(choices=[]), gr.update(choices=[]), gr.update(choices=[]), pd.DataFrame()
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
# Categories
|
| 78 |
+
categories = [
|
| 79 |
+
{
|
| 80 |
+
"topic": "Confidentiality and Privacy Protection",
|
| 81 |
+
"description": "This topic covers the protection of confidentiality, privacy, and integrity in security systems. It also includes authentication and authorization processes.",
|
| 82 |
+
"experts": ["Mireille"]
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"topic": "Distributed Trust and End-User Trust Models",
|
| 86 |
+
"description": "This topic focuses on distributed trust models and how end-users establish trust in secure systems.",
|
| 87 |
+
"experts": ["Mireille", "Khawla"]
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"topic": "Secure Element and Key Provisioning",
|
| 91 |
+
"description": "This topic involves the secure element in systems and the process of key provisioning.",
|
| 92 |
+
"experts": ["Mireille"]
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"topic": "Residential Gateway Security",
|
| 96 |
+
"description": "This topic covers the security aspects of Residential Gateways.",
|
| 97 |
+
"experts": ["Mireille"]
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"topic": "Standalone Non-Public Network (SNPN) Inter-Connection and Cybersecurity",
|
| 101 |
+
"description": "This topic focuses on the inter-connection of Standalone Non-Public Networks and related cyber-security topics.",
|
| 102 |
+
"experts": ["Khawla"]
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"topic": "Distributed Ledger and Blockchain in SNPN",
|
| 106 |
+
"description": "This topic covers the use of distributed ledger technology and blockchain in securing Standalone Non-Public Networks.",
|
| 107 |
+
"experts": ["Khawla"]
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"topic": "Distributed Networks and Communication",
|
| 111 |
+
"description": "This topic involves distributed networks such as mesh networks, ad-hoc networks, and multi-hop networks, and their cyber-security aspects.",
|
| 112 |
+
"experts": ["Guillaume"]
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"topic": "Swarm of Drones and Unmanned Aerial Vehicles Network Infrastructure",
|
| 116 |
+
"description": "This topic covers the network infrastructure deployed by Swarm of Drones and Unmanned Aerial Vehicles.",
|
| 117 |
+
"experts": ["Guillaume"]
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"topic": "USIM and Over-the-Air Services",
|
| 121 |
+
"description": "This topic involves USIM and related over-the-air services such as Steering of Roaming, roaming services, network selection, and UE configuration.",
|
| 122 |
+
"experts": ["Vincent"]
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"topic": "Eco-Design and Societal Impact of Technology",
|
| 126 |
+
"description": "This topic covers eco-design concepts, including energy saving, energy efficiency, carbon emissions, and the societal impact of technology.",
|
| 127 |
+
"experts": ["Pierre"]
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"topic": "Service Requirements of New Services",
|
| 131 |
+
"description": "This topic involves defining service requirements for new services, detecting low signals of new trends and technologies, and assessing their impact on USIM services or over-the-air services.",
|
| 132 |
+
"experts": ["Ly-Thanh"]
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"topic": "Satellite and Non Terrestrial Networks",
|
| 136 |
+
"description": "This topic covers satellite networks, Non Terrestrial Networks, Private Networks, IoT, Inter Satellite communication, and Radio Access Network.",
|
| 137 |
+
"experts": ["Nicolas"]
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"topic": "Public Safety and Emergency Communication",
|
| 141 |
+
"description": "This topic involves Public Safety Communication, Military Communication, Emergency Calls, Emergency Services, Disaster Communication Access, and other related areas.",
|
| 142 |
+
"experts": ["Dorin"]
|
| 143 |
+
}
|
| 144 |
+
]
|