Spaces:
Running
Running
Commit
•
89475a9
1
Parent(s):
365d35c
Update app.py
Browse files
app.py
CHANGED
@@ -83,6 +83,8 @@ def generate_emotion(article):
|
|
83 |
output = model_ner.predict(text)
|
84 |
print(output)
|
85 |
k = 0
|
|
|
|
|
86 |
save_data_and_sendmail(article,output)
|
87 |
for i in output:
|
88 |
for j in i:
|
@@ -93,12 +95,11 @@ def generate_emotion(article):
|
|
93 |
Entity_Types.append(j)
|
94 |
k = 0
|
95 |
result = {'Entities Found':Entities_Found, 'Entity Types':Entity_Types}
|
96 |
-
|
97 |
-
Entity_Types.clear()
|
98 |
return pd.DataFrame(result)
|
99 |
|
100 |
|
101 |
-
def save_data_and_sendmail(
|
102 |
try:
|
103 |
hostname = {}
|
104 |
hostname = get_device_ip_address()
|
@@ -106,10 +107,10 @@ def save_data_and_sendmail(Inputdata,output):
|
|
106 |
# # url = 'http://pragnakalpdev33.pythonanywhere.com/HF_space_question_generator'
|
107 |
# myobj = {'article': article,'total_que': num_que,'gen_que':result,'ip_addr':hostname.get("ip_addr",""),'host':hostname.get("host","")}
|
108 |
# x = requests.post(url, json = myobj)
|
109 |
-
|
110 |
ip = hostname.get("ip_addr","")
|
111 |
print(ip)
|
112 |
-
add_csv = [
|
113 |
with open(DATA_FILE, "a") as f:
|
114 |
writer = csv.writer(f)
|
115 |
# write the data
|
|
|
83 |
output = model_ner.predict(text)
|
84 |
print(output)
|
85 |
k = 0
|
86 |
+
Entities_Found.clear()
|
87 |
+
Entity_Types.clear()
|
88 |
save_data_and_sendmail(article,output)
|
89 |
for i in output:
|
90 |
for j in i:
|
|
|
95 |
Entity_Types.append(j)
|
96 |
k = 0
|
97 |
result = {'Entities Found':Entities_Found, 'Entity Types':Entity_Types}
|
98 |
+
|
|
|
99 |
return pd.DataFrame(result)
|
100 |
|
101 |
|
102 |
+
def save_data_and_sendmail(article,output):
|
103 |
try:
|
104 |
hostname = {}
|
105 |
hostname = get_device_ip_address()
|
|
|
107 |
# # url = 'http://pragnakalpdev33.pythonanywhere.com/HF_space_question_generator'
|
108 |
# myobj = {'article': article,'total_que': num_que,'gen_que':result,'ip_addr':hostname.get("ip_addr",""),'host':hostname.get("host","")}
|
109 |
# x = requests.post(url, json = myobj)
|
110 |
+
inputdata = article
|
111 |
ip = hostname.get("ip_addr","")
|
112 |
print(ip)
|
113 |
+
add_csv = [inputdata,Generate_text,IP]
|
114 |
with open(DATA_FILE, "a") as f:
|
115 |
writer = csv.writer(f)
|
116 |
# write the data
|