Mini-oracle can give you answers for two types of questions: Who is _? and What is _?.
It's a full-stack machine-learning application:
- backend:
- hugging-face bert-large-uncased-whole-word-masking-finetuned-squad model combined with wikipedia REST API
- frontends:
- streamlit framework, you can use the application here - mini-oracle.streamlit.app
- telegram bot API, you can use the bot here - @mini_oracle_bot
If you prefer a web interface, use the streamlit application.
- Choose the type of the question:
- Write the question content:
- Press the submit button and get results:
If you prefer a telegram bot interface, use the @mini_oracle_bot.
- Start the bot:
- Execute the
/who somebody
or/what something
commands:
If you need any help, you can always execute the /help
command:
There are several types of the errors you may get:
You should not leave the question content empty.
This is the most certainly not your fault, you should probably wait (1-3 minutes) and try again. If it doesn't help (even after several tries), you should let me know.
- Acquire Hugging Face User Access Token (https://huggingface.co/docs/hub/security-tokens)
and set it to the
HUGGING_FACE_BEARER_TOKEN
environment variable. - Acquire Wikimedia Personal API token (https://api.wikimedia.org/wiki/Documentation/Getting_started)
and set it to the
WIKI_BEARER_TOKEN
environment variable. - Set your email (that you used when registering on the Wikimedia API Portal) to the
WIKI_EMAIL
environment variable. - Go to
backend
directory. - Install dependencies:
pip install -r requirements.txt
. - Run
gunicorn -w 2 backend.src.main:app
. Follow the logs to access your server.
Remember, there are only one active endpoint:
<server_address>/answers?question_type=<question_type>&question_content=<question_content>
.
- Go to
frontend-streamlit
directory. - Optionally change the backend API endpoint (by default it is set to
mini-oracle.up.railway.app
). - Install dependencies:
pip install -r requirements.txt
. - Run
streamlit run frontend_streamlit/src/main.py
. Follow the logs to access your site.
- Create your bot using
@BotFather
bot (https://core.telegram.org/bots#how-do-i-create-a-bot) and set the token of your newly created bot to theTELEGRAM_BOT_TOKEN
environment variable. - Go to
frontend-telegram-bot
directory. - Optionally change the backend API endpoint (by default it is set to
mini-oracle.up.railway.app
). - Run
./gradlew run
(or.\gradlew.bat run
for Windows). Your bot must be up and running.