Spaces:
Running
Running
pragnakalp
commited on
Commit
•
c984fdd
1
Parent(s):
3e6975a
Update app.py
Browse files
app.py
CHANGED
@@ -51,59 +51,6 @@ bert_ner_model = os.path.join(cwd)
|
|
51 |
Entities_Found =[]
|
52 |
Entity_Types = []
|
53 |
k = 0
|
54 |
-
# def get_device_ip_address():
|
55 |
-
|
56 |
-
# if os.name == "nt":
|
57 |
-
# result = "Running on Windows"
|
58 |
-
# hostname = socket.gethostname()
|
59 |
-
# ip_address = socket.gethostbyname(hostname)
|
60 |
-
# return ip_address
|
61 |
-
# elif os.name == "posix":
|
62 |
-
# gw = os.popen("ip -4 route show default").read().split()
|
63 |
-
# s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
64 |
-
# s.connect((gw[2], 0))
|
65 |
-
# ip_address = s.getsockname()[0]
|
66 |
-
# gateway = gw[2]
|
67 |
-
# host = socket.gethostname()
|
68 |
-
# return ip_address
|
69 |
-
# else:
|
70 |
-
# result['id'] = os.name + " not supported yet."
|
71 |
-
# print(result)
|
72 |
-
# return result
|
73 |
-
|
74 |
-
# def get_location(ip_address):
|
75 |
-
# ip=ip_address
|
76 |
-
# # ip=str(request.remote_addr)
|
77 |
-
# req_data={
|
78 |
-
# "ip":ip,
|
79 |
-
# "token":"pkml123"
|
80 |
-
# }
|
81 |
-
# url = "https://demos.pragnakalp.com/get-ip-location"
|
82 |
-
|
83 |
-
# # req_data=json.dumps(req_data)
|
84 |
-
# # print("req_data",req_data)
|
85 |
-
# headers = {'Content-Type': 'application/json'}
|
86 |
-
|
87 |
-
# response = requests.request("POST", url, headers=headers, data=json.dumps(req_data))
|
88 |
-
# response = response.json()
|
89 |
-
# print("response======>>",response)
|
90 |
-
# return response
|
91 |
-
|
92 |
-
# def get_ip():
|
93 |
-
# response = requests.get('https://api64.ipify.org?format=json').json()
|
94 |
-
# return response["ip"]
|
95 |
-
|
96 |
-
|
97 |
-
# def get_location(ip_addr):
|
98 |
-
# ip_address = ip_addr
|
99 |
-
# response = requests.get(f'https://ipapi.co/{ip_address}/json/').json()
|
100 |
-
# location_data = {
|
101 |
-
# "ip": ip_address,
|
102 |
-
# "city": response.get("city"),
|
103 |
-
# "region": response.get("region"),
|
104 |
-
# "country": response.get("country_name")
|
105 |
-
# }
|
106 |
-
# return location_data
|
107 |
|
108 |
|
109 |
def getIP():
|
@@ -175,11 +122,6 @@ def save_data_and_sendmail(article,output):
|
|
175 |
commit_url = repo.push_to_hub()
|
176 |
print("commit data :",commit_url)
|
177 |
|
178 |
-
# url = 'https://pragnakalpdev35.pythonanywhere.com/HF_space_que_gen'
|
179 |
-
# # url = 'http://pragnakalpdev33.pythonanywhere.com/HF_space_question_generator'
|
180 |
-
# myobj = {'article': article,'total_que': num_que,'gen_que':result,'ip_addr':hostname.get("ip_addr",""),'host':hostname.get("host","")}
|
181 |
-
# x = requests.post(url, json = myobj)
|
182 |
-
|
183 |
url = 'https://pragnakalpdev33.pythonanywhere.com/HF_space_bert_base_ner'
|
184 |
myobj = {'article': article,'gen_text':output,'ip_addr':ip_address,"location":location}
|
185 |
x = requests.post(url, json = myobj)
|
|
|
51 |
Entities_Found =[]
|
52 |
Entity_Types = []
|
53 |
k = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
|
56 |
def getIP():
|
|
|
122 |
commit_url = repo.push_to_hub()
|
123 |
print("commit data :",commit_url)
|
124 |
|
|
|
|
|
|
|
|
|
|
|
125 |
url = 'https://pragnakalpdev33.pythonanywhere.com/HF_space_bert_base_ner'
|
126 |
myobj = {'article': article,'gen_text':output,'ip_addr':ip_address,"location":location}
|
127 |
x = requests.post(url, json = myobj)
|