Technozam commited on
Commit
0c8aed3
·
1 Parent(s): d28b205

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -55
app.py CHANGED
@@ -1,16 +1,7 @@
1
- # -*- coding: utf-8 -*-
2
- """Fill-in-BlanksGenerator.ipynb
3
-
4
- Automatically generated by Colaboratory.
5
-
6
- Original file is located at
7
- https://colab.research.google.com/drive/1tR2E8s8uQUxL6wslauPM_p20imUOhnxD
8
- """
9
-
10
  from nltk import pos_tag, word_tokenize, sent_tokenize
11
  import nltk
12
- # nltk.download('punkt')
13
- # nltk.download('averaged_perceptron_tagger')
14
  import re
15
  import random
16
  from collections import defaultdict
@@ -150,15 +141,6 @@ Running to one of the great ropes that bound him, she gnawed it until it parted,
150
  you," said the Mouse. "Now you see that even a Mouse can help a Lion." """
151
  file =None
152
 
153
- import mysql.connector
154
- import datetime;
155
-
156
- mydb = mysql.connector.connect(
157
- host="qtechdb-1.cexugk1h8rui.ap-northeast-1.rds.amazonaws.com",
158
- user="admin",
159
- password="F3v2vGWzb8vaniE3nqzi",
160
- database="spring_social"
161
- )
162
 
163
  import gradio as gr
164
 
@@ -192,17 +174,6 @@ def createdblanks_text(text,subject,total):
192
  output = output + "<br/>"
193
  i += 1
194
 
195
- # mycursor = mydb.cursor()
196
- # timedate = datetime.datetime.now()
197
-
198
- # sql = "INSERT INTO filltexts (subject, input, output, timedate) VALUES (%s,%s, %s,%s)"
199
- # val = (subject, text, output, timedate)
200
- # mycursor.execute(sql, val)
201
-
202
- # mydb.commit()
203
-
204
- # print(mycursor.rowcount, "record inserted.")
205
-
206
  return output
207
 
208
  import gradio as gr
@@ -248,19 +219,6 @@ def createdblanks(text,subject,total):
248
 
249
  def filecreate(x,subject,total):
250
 
251
- # Using Latest temp file from folder
252
-
253
- # folder_path = r'C:\Users\HP\AppData\Local\Temp'
254
- # file_type = r'\*txt'
255
- # files = glob.glob(folder_path + file_type)
256
- # max_file = max(files, key=os.path.getctime)
257
-
258
- # fp = open(max_file, 'r')
259
- # text = fp.read()
260
- # print(text)
261
- # print(fp)
262
-
263
-
264
  with open(x.name) as fo:
265
  text = fo.read()
266
  # print(text)
@@ -279,17 +237,6 @@ def filecreate(x,subject,total):
279
  else:
280
 
281
  generated = createdblanks(text,subject, total)
282
- # mycursor = mydb.cursor()
283
-
284
- # timedate= datetime.datetime.now()
285
-
286
- # sql = "INSERT INTO fillfiles (subject, input, output, timedate) VALUES (%s,%s, %s,%s)"
287
- # val = (subject, text, generated, timedate)
288
- # mycursor.execute(sql, val)
289
-
290
- # mydb.commit()
291
-
292
- # print(mycursor.rowcount, "record inserted.")
293
 
294
  return generated
295
 
 
 
 
 
 
 
 
 
 
 
1
  from nltk import pos_tag, word_tokenize, sent_tokenize
2
  import nltk
3
+ nltk.download('punkt')
4
+ nltk.download('averaged_perceptron_tagger')
5
  import re
6
  import random
7
  from collections import defaultdict
 
141
  you," said the Mouse. "Now you see that even a Mouse can help a Lion." """
142
  file =None
143
 
 
 
 
 
 
 
 
 
 
144
 
145
  import gradio as gr
146
 
 
174
  output = output + "<br/>"
175
  i += 1
176
 
 
 
 
 
 
 
 
 
 
 
 
177
  return output
178
 
179
  import gradio as gr
 
219
 
220
  def filecreate(x,subject,total):
221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  with open(x.name) as fo:
223
  text = fo.read()
224
  # print(text)
 
237
  else:
238
 
239
  generated = createdblanks(text,subject, total)
 
 
 
 
 
 
 
 
 
 
 
240
 
241
  return generated
242