Spaces:
Running
Running
pragnakalp
commited on
Commit
•
066b4d7
1
Parent(s):
89a2478
Update app.py
Browse files
app.py
CHANGED
@@ -45,28 +45,6 @@ model_path = os.path.join(cwd)
|
|
45 |
tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-emotion")
|
46 |
model_base = AutoModelWithLMHead.from_pretrained(model_path)
|
47 |
|
48 |
-
"""
|
49 |
-
get ip address and location
|
50 |
-
"""
|
51 |
-
# def get_device_ip_address():
|
52 |
-
# if os.name == "nt":
|
53 |
-
# result = "Running on Windows"
|
54 |
-
# hostname = socket.gethostname()
|
55 |
-
# ip_address = socket.gethostbyname(hostname)
|
56 |
-
# print(ip_address)
|
57 |
-
# return ip_address
|
58 |
-
# elif os.name == "posix":
|
59 |
-
# gw = os.popen("ip -4 route show default").read().split()
|
60 |
-
# s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
61 |
-
# s.connect((gw[2], 0))
|
62 |
-
# ip_address = s.getsockname()[0]
|
63 |
-
# gateway = gw[2]
|
64 |
-
# host = socket.gethostname()
|
65 |
-
# return ip_address
|
66 |
-
# else:
|
67 |
-
# result['id'] = os.name + " not supported yet."
|
68 |
-
# print(result)
|
69 |
-
# return result
|
70 |
|
71 |
def getIP():
|
72 |
ip_address = ''
|
@@ -171,11 +149,9 @@ def save_data_and_sendmail(article,results_dict,sen_list,results):
|
|
171 |
# url = 'https://pragnakalpdev35.pythonanywhere.com/HF_space_emotion_detection'
|
172 |
|
173 |
myobj = {"sentences":sen_list,"gen_results":results,"ip_addr":ip_address,'loc':location}
|
174 |
-
print("myobj###### ",myobj)
|
175 |
response = requests.post(url, json = myobj)
|
176 |
print("response=-----=",response.status_code)
|
177 |
-
|
178 |
-
|
179 |
except Exception as e:
|
180 |
return "Error while sending mail" + str(e)
|
181 |
|
|
|
45 |
tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-emotion")
|
46 |
model_base = AutoModelWithLMHead.from_pretrained(model_path)
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
def getIP():
|
50 |
ip_address = ''
|
|
|
149 |
# url = 'https://pragnakalpdev35.pythonanywhere.com/HF_space_emotion_detection'
|
150 |
|
151 |
myobj = {"sentences":sen_list,"gen_results":results,"ip_addr":ip_address,'loc':location}
|
|
|
152 |
response = requests.post(url, json = myobj)
|
153 |
print("response=-----=",response.status_code)
|
154 |
+
|
|
|
155 |
except Exception as e:
|
156 |
return "Error while sending mail" + str(e)
|
157 |
|