Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge final integration branch to main #20

Merged
merged 15 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@

Readability is an eBook reader application that provide reading assistant services.


## Features

- Feature 1: Summary for previous contents
- Feature 2: Quiz generation

- Ebook Viewer with overlay
- E-Book Viewer with overlay
- Upload own book with txt file

## Getting Started

### Prerequisites

- Android Studio [version, e.g., 4.2.1]
- Minimum Android SDK Version [e.g., 21]
#### Frontend

- Android Studio Giraffe (2022.3) or above
- Minimum Android SDK Version: 24
- Target Android SDK Version: 34

### Installation
#### Backend

[Installation link here]
- OpenAI key for GPT-4
- A MySQL server
3 changes: 3 additions & 0 deletions backend/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Union

from fastapi.staticfiles import StaticFiles
from routers.ai import ai
from routers.book import book
from routers.user import user
Expand All @@ -9,6 +11,7 @@
app.include_router(ai)
app.include_router(book)
app.include_router(user)
app.mount("/static", StaticFiles(directory="static"), name="static")

if __name__ == "__main__":
import uvicorn
Expand Down
103 changes: 103 additions & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
accelerate==0.23.0
aiohttp==3.8.6
aiosignal==1.3.1
annotated-types==0.6.0
anyio==3.7.1
async-timeout==4.0.3
attrs==23.1.0
auto-gptq==0.4.2+cu118
autopep8==2.0.4
bcrypt==4.0.1
certifi==2023.7.22
cffi==1.16.0
charset-normalizer==3.3.0
click==8.1.7
coloredlogs==15.0.1
coverage==7.3.2
cryptography==41.0.5
datasets==2.14.5
dill==0.3.7
exceptiongroup==1.1.3
fastapi==0.103.2
filelock==3.12.4
frozenlist==1.4.0
fsspec==2023.6.0
gunicorn==21.2.0
h11==0.14.0
httpcore==1.0.1
httptools==0.6.0
httpx==0.25.1
huggingface-hub==0.18.0
humanfriendly==10.0
idna==3.4
iniconfig==2.0.0
Jinja2==3.1.2
MarkupSafe==2.1.3
mpmath==1.3.0
multidict==6.0.4
multiprocess==0.70.15
mysql-connector-python==8.2.0
networkx==3.1
numpy==1.24.4
nvidia-cublas-cu12==12.1.3.1
nvidia-cuda-cupti-cu12==12.1.105
nvidia-cuda-nvrtc-cu12==12.1.105
nvidia-cuda-runtime-cu12==12.1.105
nvidia-cudnn-cu12==8.9.2.26
nvidia-cufft-cu12==11.0.2.54
nvidia-curand-cu12==10.3.2.106
nvidia-cusolver-cu12==11.4.5.107
nvidia-cusparse-cu12==12.1.0.106
nvidia-nccl-cu12==2.18.1
nvidia-nvjitlink-cu12==12.2.140
nvidia-nvtx-cu12==12.1.105
openai==0.28.1
optimum==1.13.2
packaging==23.2
pandas==2.0.3
passlib==1.7.4
peft==0.5.0
Pillow==10.1.0
pluggy==1.3.0
protobuf==4.21.12
psutil==5.9.5
pyarrow==13.0.0
pycodestyle==2.11.1
pycparser==2.21
pydantic==2.4.2
pydantic-core==2.10.1
PyJWT==2.8.0
pytest==7.4.2
pytest-cov==4.1.0
python-dateutil==2.8.2
python-dotenv==1.0.0
python-multipart==0.0.6
pytz==2023.3.post1
PyYAML==6.0.1
regex==2023.10.3
requests==2.31.0
rouge==1.0.1
safetensors==0.4.0
sentencepiece==0.1.99
six==1.16.0
sniffio==1.3.0
sse-starlette==1.6.5
starlette==0.27.0
sympy==1.12
tenacity==8.2.3
tiktoken==0.5.1
tokenizers==0.14.1
tomli==2.0.1
torch==2.1.0
tqdm==4.66.1
transformers==4.34.0
triton==2.1.0
typing-extensions==4.8.0
tzdata==2023.3
urllib3==2.0.6
uvicorn==0.23.2
uvloop==0.17.0
watchfiles==0.20.0
websockets==11.0.3
xxhash==3.4.1
yarl==1.9.2
110 changes: 110 additions & 0 deletions backend/static/privacy_policy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width'>
<title>Privacy Policy</title>
<style> body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; padding:1em; } </style>
</head>
<body>
<strong>Privacy Policy</strong> <p>
Turkey built the Readability app as
a Free app. This SERVICE is provided by
Turkey at no cost and is intended for use as
is.
</p> <p>
This page is used to inform visitors regarding our
policies with the collection, use, and disclosure of Personal
Information if anyone decided to use our Service.
</p> <p>
If you choose to use our Service, then you agree to
the collection and use of information in relation to this
policy. The Personal Information that we collect is
used for providing and improving the Service. We will not use or share your information with
anyone except as described in this Privacy Policy.
</p> <p>
The terms used in this Privacy Policy have the same meanings
as in our Terms and Conditions, which are accessible at
Readability unless otherwise defined in this Privacy Policy.
</p> <p><strong>Information Collection and Use</strong></p> <p>
For a better experience, while using our Service, we
may require you to provide us with certain personally
identifiable information, including but not limited to email, username. The information that
we request will be retained by us and used as described in this privacy policy.
</p> <div><p>
The app does use third-party services that may collect
information used to identify you.
</p> <p>
Link to the privacy policy of third-party service providers used
by the app
</p> <ul><li><a href="https://www.google.com/policies/privacy/" target="_blank" rel="noopener noreferrer">Google Play Services</a></li><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----></ul></div> <p><strong>Log Data</strong></p> <p>
We want to inform you that whenever you
use our Service, in a case of an error in the app
we collect data and information (through third-party
products) on your phone called Log Data. This Log Data may
include information such as your device Internet Protocol
(“IP”) address, device name, operating system version, the
configuration of the app when utilizing our Service,
the time and date of your use of the Service, and other
statistics.
</p> <p><strong>Cookies</strong></p> <p>
Cookies are files with a small amount of data that are
commonly used as anonymous unique identifiers. These are sent
to your browser from the websites that you visit and are
stored on your device's internal memory.
</p> <p>
This Service does not use these “cookies” explicitly. However,
the app may use third-party code and libraries that use
“cookies” to collect information and improve their services.
You have the option to either accept or refuse these cookies
and know when a cookie is being sent to your device. If you
choose to refuse our cookies, you may not be able to use some
portions of this Service.
</p> <p><strong>Service Providers</strong></p> <p>
We may employ third-party companies and
individuals due to the following reasons:
</p> <ul><li>To facilitate our Service;</li> <li>To provide the Service on our behalf;</li> <li>To perform Service-related services; or</li> <li>To assist us in analyzing how our Service is used.</li></ul> <p>
We want to inform users of this Service
that these third parties have access to their Personal
Information. The reason is to perform the tasks assigned to
them on our behalf. However, they are obligated not to
disclose or use the information for any other purpose.
</p> <p><strong>Security</strong></p> <p>
We value your trust in providing us your
Personal Information, thus we are striving to use commercially
acceptable means of protecting it. But remember that no method
of transmission over the internet, or method of electronic
storage is 100% secure and reliable, and we cannot
guarantee its absolute security.
</p> <p><strong>Links to Other Sites</strong></p> <p>
This Service may contain links to other sites. If you click on
a third-party link, you will be directed to that site. Note
that these external sites are not operated by us.
Therefore, we strongly advise you to review the
Privacy Policy of these websites. We have
no control over and assume no responsibility for the content,
privacy policies, or practices of any third-party sites or
services.
</p> <p><strong>Children’s Privacy</strong></p> <div><p>
These Services do not address anyone under the age of 13.
We do not knowingly collect personally
identifiable information from children under 13 years of age. In the case
we discover that a child under 13 has provided
us with personal information, we immediately
delete this from our servers. If you are a parent or guardian
and you are aware that your child has provided us with
personal information, please contact us so that
we will be able to do the necessary actions.
</p></div> <!----> <p><strong>Changes to This Privacy Policy</strong></p> <p>
We may update our Privacy Policy from
time to time. Thus, you are advised to review this page
periodically for any changes. We will
notify you of any changes by posting the new Privacy Policy on
this page.
</p> <p>This policy is effective as of 2023-12-10</p> <p><strong>Contact Us</strong></p> <p>
If you have any questions or suggestions about our
Privacy Policy, do not hesitate to contact us at [email protected].
</p> <p>This privacy policy page was created at <a href="https://privacypolicytemplate.net" target="_blank" rel="noopener noreferrer">privacypolicytemplate.net </a>and modified/generated by <a href="https://app-privacy-policy-generator.nisrulz.com/" target="_blank" rel="noopener noreferrer">App Privacy Policy Generator</a></p>
</body>
</html>

114 changes: 114 additions & 0 deletions backend/static/terms_and_conditions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width'>
<title>Terms &amp; Conditions</title>
<style> body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; padding:1em; } </style>
</head>
<body>
<strong>Terms &amp; Conditions</strong> <p>
By downloading or using the app, these terms will
automatically apply to you – you should make sure therefore
that you read them carefully before using the app. You’re not
allowed to copy or modify the app, any part of the app, or
our trademarks in any way. You’re not allowed to attempt to
extract the source code of the app, and you also shouldn’t try
to translate the app into other languages or make derivative
versions. The app itself, and all the trademarks, copyright,
database rights, and other intellectual property rights related
to it, still belong to Turkey.
</p> <p>
Turkey is committed to ensuring that the app is
as useful and efficient as possible. For that reason, we
reserve the right to make changes to the app or to charge for
its services, at any time and for any reason. We will never
charge you for the app or its services without making it very
clear to you exactly what you’re paying for.
</p> <p>
The Readability app stores and processes personal data that
you have provided to us, to provide our
Service. It’s your responsibility to keep your phone and
access to the app secure. We therefore recommend that you do
not jailbreak or root your phone, which is the process of
removing software restrictions and limitations imposed by the
official operating system of your device. It could make your
phone vulnerable to malware/viruses/malicious programs,
compromise your phone’s security features and it could mean
that the Readability app won’t work properly or at all.
</p> <div><p>
The app does use third-party services that declare their
Terms and Conditions.
</p> <p>
Link to Terms and Conditions of third-party service
providers used by the app
</p> <ul><li><a href="https://policies.google.com/terms" target="_blank" rel="noopener noreferrer">Google Play Services</a></li><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----><!----></ul></div> <p>
You should be aware that there are certain things that
Turkey will not take responsibility for. Certain
functions of the app will require the app to have an active
internet connection. The connection can be Wi-Fi or provided
by your mobile network provider, but Turkey
cannot take responsibility for the app not working at full
functionality if you don’t have access to Wi-Fi, and you don’t
have any of your data allowance left.
</p> <p></p> <p>
If you’re using the app outside of an area with Wi-Fi, you
should remember that the terms of the agreement with your
mobile network provider will still apply. As a result, you may
be charged by your mobile provider for the cost of data for
the duration of the connection while accessing the app, or
other third-party charges. In using the app, you’re accepting
responsibility for any such charges, including roaming data
charges if you use the app outside of your home territory
(i.e. region or country) without turning off data roaming. If
you are not the bill payer for the device on which you’re
using the app, please be aware that we assume that you have
received permission from the bill payer for using the app.
</p> <p>
Along the same lines, Turkey cannot always take
responsibility for the way you use the app i.e. You need to
make sure that your device stays charged – if it runs out of
battery and you can’t turn it on to avail the Service,
Turkey cannot accept responsibility.
</p> <p>
With respect to Turkey’s responsibility for your
use of the app, when you’re using the app, it’s important to
bear in mind that although we endeavor to ensure that it is
updated and correct at all times, we do rely on third parties
to provide information to us so that we can make it available
to you. Turkey accepts no liability for any
loss, direct or indirect, you experience as a result of
relying wholly on this functionality of the app.
</p> <p>
At some point, we may wish to update the app. The app is
currently available on Android – the requirements for the
system(and for any additional systems we
decide to extend the availability of the app to) may change,
and you’ll need to download the updates if you want to keep
using the app. Turkey does not promise that it
will always update the app so that it is relevant to you
and/or works with the Android version that you have
installed on your device. However, you promise to always
accept updates to the application when offered to you, We may
also wish to stop providing the app, and may terminate use of
it at any time without giving notice of termination to you.
Unless we tell you otherwise, upon any termination, (a) the
rights and licenses granted to you in these terms will end;
(b) you must stop using the app, and (if needed) delete it
from your device.
</p> <p><strong>Changes to This Terms and Conditions</strong></p> <p>
We may update our Terms and Conditions
from time to time. Thus, you are advised to review this page
periodically for any changes. We will
notify you of any changes by posting the new Terms and
Conditions on this page.
</p> <p>
These terms and conditions are effective as of 2023-12-10
</p> <p><strong>Contact Us</strong></p> <p>
If you have any questions or suggestions about our
Terms and Conditions, do not hesitate to contact us
at [email protected].
</p> <p>This Terms and Conditions page was generated by <a href="https://app-privacy-policy-generator.nisrulz.com/" target="_blank" rel="noopener noreferrer">App Privacy Policy Generator</a></p>
</body>
</html>

9 changes: 8 additions & 1 deletion backend/tests/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
reduce_multiple_summaries_to_one, reduce_summaries_list,
generate_summary_tree, update_summary_path_url, get_number_of_inferences
)
from llama.custom_type import Summary
from llama.custom_type import Summary, ProxyAIBackend, GPT4Backend, GPT3Backend
import random
import string
import tiktoken
Expand Down Expand Up @@ -161,3 +161,10 @@ def test_get_number_of_inferences():
expected4 = 1
assert get_number_of_inferences(len(list4)) == expected4, "Failed on list smaller than split size"
print("fourth case passed")

def test_proxy_pattern():
ai_backend = ProxyAIBackend(GPT4Backend())
assert type(ai_backend.summary_generator) == GPT4Backend
ai_backend.summary_generator = GPT3Backend()
assert type(ai_backend.summary_generator) == GPT3Backend

Loading
Loading