pragnakalp commited on
Commit
be1022c
1 Parent(s): 517905d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -118,23 +118,24 @@ def save_data_and_sendmail(article,output):
118
  ip_address = ''
119
  ip_address = get_device_ip_address()
120
  location = get_location(ip_address)
 
 
 
 
 
 
 
 
 
121
  # url = 'https://pragnakalpdev35.pythonanywhere.com/HF_space_que_gen'
122
  # # url = 'http://pragnakalpdev33.pythonanywhere.com/HF_space_question_generator'
123
  # myobj = {'article': article,'total_que': num_que,'gen_que':result,'ip_addr':hostname.get("ip_addr",""),'host':hostname.get("host","")}
124
  # x = requests.post(url, json = myobj)
125
 
126
- inputdata = article
127
  url = 'https://pragnakalpdev33.pythonanywhere.com/HF_space_bert_base_ner'
128
  myobj = {'article': article,'gen_text':output,'ip_addr':ip_address,'loc':location}
129
  x = requests.post(url, json = myobj)
130
 
131
- add_csv = [inputdata,output,ip_address,location]
132
- with open(DATA_FILE, "a") as f:
133
- writer = csv.writer(f)
134
- # write the data
135
- writer.writerow(add_csv)
136
- commit_url = repo.push_to_hub()
137
- print("commit data :",commit_url)
138
  return "Successfully save data"
139
 
140
  except Exception as e:
@@ -167,7 +168,7 @@ demo = gr.Interface(
167
  output,
168
  title="Named Entity Recognition Using BERT",
169
  css=".gradio-container {background-color: lightgray}",
170
- article="""Feel free to give us your [feedback](https://www.pragnakalp.com/contact/) on this NER demo.For all your Named Entity Recognition related
171
  requirements, we are here to help you. Email us your requirement at [[email protected]]("mailto:[email protected]").
172
  And don't forget to check out more interesting [NLP services](https://www.pragnakalp.com/services/natural-language-processing-services/) we are offering.
173
  <p style='text-align: center;'>Developed by :[ Pragnakalp Techlabs](https://www.pragnakalp.com)</p>"""
 
118
  ip_address = ''
119
  ip_address = get_device_ip_address()
120
  location = get_location(ip_address)
121
+
122
+ add_csv = [article,output,ip_address,location]
123
+ with open(DATA_FILE, "a") as f:
124
+ writer = csv.writer(f)
125
+ # write the data
126
+ writer.writerow(add_csv)
127
+ commit_url = repo.push_to_hub()
128
+ print("commit data :",commit_url)
129
+
130
  # url = 'https://pragnakalpdev35.pythonanywhere.com/HF_space_que_gen'
131
  # # url = 'http://pragnakalpdev33.pythonanywhere.com/HF_space_question_generator'
132
  # myobj = {'article': article,'total_que': num_que,'gen_que':result,'ip_addr':hostname.get("ip_addr",""),'host':hostname.get("host","")}
133
  # x = requests.post(url, json = myobj)
134
 
 
135
  url = 'https://pragnakalpdev33.pythonanywhere.com/HF_space_bert_base_ner'
136
  myobj = {'article': article,'gen_text':output,'ip_addr':ip_address,'loc':location}
137
  x = requests.post(url, json = myobj)
138
 
 
 
 
 
 
 
 
139
  return "Successfully save data"
140
 
141
  except Exception as e:
 
168
  output,
169
  title="Named Entity Recognition Using BERT",
170
  css=".gradio-container {background-color: lightgray}",
171
+ article="""Feel free to give us your [feedback](https://www.pragnakalp.com/contact/) on this NER demo. For all your Named Entity Recognition related
172
  requirements, we are here to help you. Email us your requirement at [[email protected]]("mailto:[email protected]").
173
  And don't forget to check out more interesting [NLP services](https://www.pragnakalp.com/services/natural-language-processing-services/) we are offering.
174
  <p style='text-align: center;'>Developed by :[ Pragnakalp Techlabs](https://www.pragnakalp.com)</p>"""