Spaces:
Runtime error
Runtime error
CognitiveScience
commited on
Commit
•
43e3ada
1
Parent(s):
27614c8
Update app.py
Browse files
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 |
-
|
|
|
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 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
else:
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
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)
|