Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankith Reddy Chitti authored and Ankith Reddy Chitti committed Aug 25, 2023
1 parent 4773e39 commit 609c59b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
12 changes: 5 additions & 7 deletions apps/url_summary/url_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@

import evadb

CHATGPT_UDF_PATH = "../../evadb/udfs/chatgpt.py"

DEFAULT_URL = "https://alphasec.io/what-are-passkeys/"


def cleanup():
"""Removes any temporary file / directory created by EvaDB."""
if os.path.exists("transcript.csv"):
os.remove("transcript.csv")
if os.path.exists("summary.csv"):
os.remove("summary.csv")
if os.path.exists("evadb_data"):
shutil.rmtree("evadb_data")

Expand Down Expand Up @@ -58,18 +56,18 @@ def cleanup():
url_data = UnstructuredURLLoader(urls=[url_link]).load()

df = pd.DataFrame({"text": [url_data]})
df.to_csv("transcript.csv")
df.to_csv("summary.csv")
print(df)

print("📶 Establishing evadb api cursor connection.")
cursor = evadb.connect().cursor()

# Load chunked transcript into table
# Load summary into table
cursor.drop_table("URL_Summary", if_exists=True).execute()
cursor.query(
"""CREATE TABLE IF NOT EXISTS URL_Summary (text TEXT(4096));"""
).execute()
cursor.load("transcript.csv", "URL_Summary", "csv").execute()
cursor.load("summary.csv", "URL_Summary", "csv").execute()

# Generate summary with chatgpt udf
print("⏳ Generating Summary (may take a while)... \n")
Expand Down
16 changes: 15 additions & 1 deletion test/app_tests/test_url_summary.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# coding=utf-8
# Copyright 2018-2023 EvaDB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import subprocess
import unittest
Expand Down Expand Up @@ -40,4 +54,4 @@ def test_should_run_url_summary_app(self):
decoded_stdout = stdout.decode()
assert "Passkeys" or "AliExpress" or "Rate limit" in decoded_stdout
print(decoded_stdout)
print(stderr.decode())
print(stderr.decode())

0 comments on commit 609c59b

Please sign in to comment.