Spaces:
Runtime error
Runtime error
Commit
·
912a28c
1
Parent(s):
8673f28
Update app.py
Browse files
app.py
CHANGED
@@ -85,22 +85,24 @@ def get_latest_reviews2(db: sqlite3.Connection):
|
|
85 |
|
86 |
def ccogsphere(name: str, rate: int, celsci: str):
|
87 |
db = sqlite3.connect(DB_FILE)
|
88 |
-
cursor = db.cursor()
|
89 |
-
|
90 |
#try:
|
91 |
celsci2=celsci.split()
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
104 |
|
105 |
reviews, total_reviews = get_latest_reviews(db)
|
106 |
db.close()
|
@@ -176,15 +178,11 @@ with gr.Blocks() as demo:
|
|
176 |
submit = gr.Button(value=".")
|
177 |
submit.click(ccogsphere, [name, rate, celsci], [data, count])
|
178 |
demo.load(load_data, None, [data, count])
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
#if name=="abc":
|
185 |
-
#run_code()
|
186 |
-
load_data()
|
187 |
-
#return "Hello " + name + "!"
|
188 |
with gr.Row():
|
189 |
with gr.Column():
|
190 |
potc = gr.ChatInterface(fn=echo, examples=["hello", "hola", "merhaba"], title="Echo Bot")
|
|
|
85 |
|
86 |
def ccogsphere(name: str, rate: int, celsci: str):
|
87 |
db = sqlite3.connect(DB_FILE)
|
88 |
+
cursor = db.cursor()
|
|
|
89 |
#try:
|
90 |
celsci2=celsci.split()
|
91 |
+
celsciy=celsci2[0] + "+" + celsci2[1]
|
92 |
+
if celsci=="Celscis List":
|
93 |
+
cursor.execute("INSERT INTO reviews(name, view, duration) VALUES(?,?,?)", [celsci2[0], " wrote: " , celsci2[1:]])
|
94 |
+
db.commit()
|
95 |
+
else:
|
96 |
+
celsci2=ecf(celsciy)
|
97 |
+
df=pd.DataFrame.from_dict(celsci2["videos"])
|
98 |
+
celsci2=json.dumps(celsci2["videos"])
|
99 |
+
for index, row in df.iterrows():
|
100 |
+
view = str(row["views"])
|
101 |
+
duration = str(row["duration"])
|
102 |
+
print(view, duration)
|
103 |
+
#celsci=celsci+celsci2
|
104 |
+
cursor.execute("INSERT INTO reviews(name, view, duration) VALUES(?,?,?)", [celsci+str(index+1), view, duration])
|
105 |
+
db.commit()
|
106 |
|
107 |
reviews, total_reviews = get_latest_reviews(db)
|
108 |
db.close()
|
|
|
178 |
submit = gr.Button(value=".")
|
179 |
submit.click(ccogsphere, [name, rate, celsci], [data, count])
|
180 |
demo.load(load_data, None, [data, count])
|
181 |
+
#@name.change(inputs=name, outputs=celsci,_js="window.location.reload()")
|
182 |
+
#@rate.change(inputs=rate, outputs=name,_js="window.location.reload()")
|
183 |
+
#@celsci.change(inputs=celsci, outputs=rate,_js="window.location.reload()")
|
184 |
+
#def secwork(name):
|
185 |
+
# load_data()
|
|
|
|
|
|
|
|
|
186 |
with gr.Row():
|
187 |
with gr.Column():
|
188 |
potc = gr.ChatInterface(fn=echo, examples=["hello", "hola", "merhaba"], title="Echo Bot")
|