Commit
·
4ec9ea8
1
Parent(s):
a3d60ee
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,25 +42,6 @@ repo = Repository(
|
|
| 42 |
local_dir="que_gen_logs", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
| 43 |
)
|
| 44 |
|
| 45 |
-
# def get_device_ip_address():
|
| 46 |
-
# if os.name == "nt":
|
| 47 |
-
# result = "Running on Windows"
|
| 48 |
-
# hostname = socket.gethostname()
|
| 49 |
-
# ip_address = socket.gethostbyname(hostname)
|
| 50 |
-
# return ip_address
|
| 51 |
-
# elif os.name == "posix":
|
| 52 |
-
# gw = os.popen("ip -4 route show default").read().split()
|
| 53 |
-
# s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
| 54 |
-
# s.connect((gw[2], 0))
|
| 55 |
-
# ip_address = s.getsockname()[0]
|
| 56 |
-
# gateway = gw[2]
|
| 57 |
-
# host = socket.gethostname()
|
| 58 |
-
# print("----->",ip_address)
|
| 59 |
-
# return ip_address
|
| 60 |
-
# else:
|
| 61 |
-
# result['id'] = os.name + " not supported yet."
|
| 62 |
-
# print(result)
|
| 63 |
-
# return result
|
| 64 |
|
| 65 |
def getIP():
|
| 66 |
ip_address = ''
|
|
@@ -139,12 +120,7 @@ def save_data_and_sendmail(article,generated_questions,num_que):
|
|
| 139 |
myobj = {'article': article,'total_que': num_que,'gen_que':generated_questions,'ip_addr':ip_address,'loc':location}
|
| 140 |
x = requests.post(url, json = myobj)
|
| 141 |
print("myobj^^^^^",myobj)
|
| 142 |
-
|
| 143 |
-
# data = json.load(file)
|
| 144 |
-
# data.append(entry)
|
| 145 |
-
# with open(DATA_FILE, "w") as file:
|
| 146 |
-
# json.dump(data, file)
|
| 147 |
-
# commit_url = repo.push_to_hub()
|
| 148 |
except Exception as e:
|
| 149 |
return "Error while sending mail" + str(e)
|
| 150 |
|
|
@@ -153,7 +129,7 @@ def save_data_and_sendmail(article,generated_questions,num_que):
|
|
| 153 |
## design 1
|
| 154 |
inputs=gr.Textbox(value=article_value, lines=5, label="Input Text/Article",elem_id="inp_div")
|
| 155 |
total_que = gr.Textbox(label="Number of questions to generate",elem_id="inp_div")
|
| 156 |
-
outputs=gr.Textbox(
|
| 157 |
|
| 158 |
demo = gr.Interface(
|
| 159 |
generate_questions,
|
|
@@ -161,10 +137,11 @@ demo = gr.Interface(
|
|
| 161 |
outputs,
|
| 162 |
title="Question Generation Using T5-Base Model",
|
| 163 |
css=".gradio-container {background-color: lightgray} #inp_div {background-color: #7FB3D5;}",
|
| 164 |
-
article="""Feel free to give us your
|
|
|
|
| 165 |
if you want to have your own Questions-Generation using T5 model. We are just one click away. And don't forget to check out more interesting
|
| 166 |
-
|
| 167 |
-
<p style='text-align: center;'>Developed by
|
| 168 |
|
| 169 |
)
|
| 170 |
demo.launch(enable_queue = False)
|
|
|
|
| 42 |
local_dir="que_gen_logs", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
| 43 |
)
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
def getIP():
|
| 47 |
ip_address = ''
|
|
|
|
| 120 |
myobj = {'article': article,'total_que': num_que,'gen_que':generated_questions,'ip_addr':ip_address,'loc':location}
|
| 121 |
x = requests.post(url, json = myobj)
|
| 122 |
print("myobj^^^^^",myobj)
|
| 123 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
except Exception as e:
|
| 125 |
return "Error while sending mail" + str(e)
|
| 126 |
|
|
|
|
| 129 |
## design 1
|
| 130 |
inputs=gr.Textbox(value=article_value, lines=5, label="Input Text/Article",elem_id="inp_div")
|
| 131 |
total_que = gr.Textbox(label="Number of questions to generate",elem_id="inp_div")
|
| 132 |
+
outputs=gr.Textbox(label="Generated Questions",elem_id="inp_div")
|
| 133 |
|
| 134 |
demo = gr.Interface(
|
| 135 |
generate_questions,
|
|
|
|
| 137 |
outputs,
|
| 138 |
title="Question Generation Using T5-Base Model",
|
| 139 |
css=".gradio-container {background-color: lightgray} #inp_div {background-color: #7FB3D5;}",
|
| 140 |
+
article="""<p style='text-align: center;'>Feel free to give us your <a href="https://www.pragnakalp.com/contact/" target="_blank">feedback</a> and contact us at
|
| 141 |
+
<a href="mailto:letstalk@pragnakalp.com" target="_blank">letstalk@pragnakalp.com</a>
|
| 142 |
if you want to have your own Questions-Generation using T5 model. We are just one click away. And don't forget to check out more interesting
|
| 143 |
+
<a href="https://www.pragnakalp.com/services/natural-language-processing-services/" target="_blank">NLP services</a> we are offering.</p>
|
| 144 |
+
<p style='text-align: center;'>Developed by :<a href="https://www.pragnakalp.com" target="_blank"> Pragnakalp Techlabs</a></p>"""
|
| 145 |
|
| 146 |
)
|
| 147 |
demo.launch(enable_queue = False)
|