CognitiveScience commited on
Commit
43e3ada
1 Parent(s): 27614c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -16
app.py CHANGED
@@ -72,9 +72,12 @@ except sqlite3.OperationalError:
72
 
73
  def get_latest_reviews(db: sqlite3.Connection):
74
  reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
 
 
75
  total_reviews = db.execute("Select COUNT(id) from reviews").fetchone()[0]
76
  reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "rate", "celsci"])
77
- return reviews, total_reviews
 
78
 
79
 
80
  def ccogsphere(name: str, rate: int, celsci: str):
@@ -129,22 +132,22 @@ def run_ecs(inp):
129
 
130
  def load_data(celsci: str):
131
  db = sqlite3.connect(DB_FILE)
132
- reviews, total_reviews = get_latest_reviews(db)
133
  db.close()
134
- if celsci!="":
135
- inp=celsci.split()
136
- inp=inp[0] + "+" + inp[1]
137
- result=ecf(inp)
138
- df=pd.DataFrame.from_dict(result["videos"])
139
- else:
140
- # Creating a sample dataframe
141
- df = pd.DataFrame({
142
- "A" : [14, 4, 5, 4, 1],
143
- "B" : [5, 2, 54, 3, 2],
144
- "C" : [20, 20, 7, 3, 8],
145
- "D" : [14, 3, 6, 2, 6],
146
- "E" : [23, 45, 64, 32, 23]
147
- })
148
  return df, reviews, total_reviews
149
  def load_data2():
150
  #result=run_ecs(celscie)
 
72
 
73
  def get_latest_reviews(db: sqlite3.Connection):
74
  reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
75
+ reviews = db.execute("SELECT * FROM reviews2 ORDER BY id DESC limit 100").fetchall()
76
+
77
  total_reviews = db.execute("Select COUNT(id) from reviews").fetchone()[0]
78
  reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "rate", "celsci"])
79
+ reviews2 = pd.DataFrame(reviews2, columns=["id","title", "link","channel", "description", "views", "uploaded", "duration", "durationString"])
80
+ return reviews2, reviews, total_reviews
81
 
82
 
83
  def ccogsphere(name: str, rate: int, celsci: str):
 
132
 
133
  def load_data(celsci: str):
134
  db = sqlite3.connect(DB_FILE)
135
+ df, reviews, total_reviews = get_latest_reviews(db)
136
  db.close()
137
+ #if celsci!="":
138
+ # inp=celsci.split()
139
+ # inp=inp[0] + "+" + inp[1]
140
+ # result=ecf(inp)
141
+ # df=pd.DataFrame.from_dict(result["videos"])
142
+ #else:
143
+ # # Creating a sample dataframe
144
+ # df = pd.DataFrame({
145
+ # "A" : [14, 4, 5, 4, 1],
146
+ # "B" : [5, 2, 54, 3, 2],
147
+ # "C" : [20, 20, 7, 3, 8],
148
+ # "D" : [14, 3, 6, 2, 6],
149
+ # "E" : [23, 45, 64, 32, 23]
150
+ # })
151
  return df, reviews, total_reviews
152
  def load_data2():
153
  #result=run_ecs(celscie)