jswope00 / AI-Microapp-Template-Assistant

This is a template for an AI "Assessment" Micro-app that allows you to build an AI-powered assessment like configuring a form.
MIT License
2 stars 0 forks source link

AI MicroApp (Assistant)

Overview

This AI MicroApp template is a simple Streamlit application that demonstrates how to integrate AI models with a web interface using Streamlit. It means that you can build and share AI "MicroApps" as simply as building a form.

It works with the OpenAI Assistant API and similar. An AI Assistant guides the user through "phases" in a conversation-style interaction.

It can:

Scoring is based on a faculty-defined rubric on the backend. These rubrics can be simple (i.e. "full points if the student gives a thoughtful answer") or specific with different criteria and point thresholds. The faculty also defines a minimum pass threshold for each question. The threshold could be as low as zero points to pass any answer, or it could be higher.

This application also doesn't store data anywhere except for some storage required in the local browser which is cleared after the session ends.

Prerequisites

Local Setup Instructions

1. Clone the repository

Navigate to a location where you'd like to run this app from, and clone the repo:

git clone https://github.com/jswope00/AI-MicroApp-Template-Assistant.git

2. Create a Virtual Environment

To create a virtual environment, navigate to your project directory in the terminal:

cd AI-MicroApp-Template-Assistant

It's recommended to isolate the project's dependencies using a virtual environment. You can utilize tools like venv or virtualenv to achieve this. Refer to official documentation for specific commands based on your chosen tool. Here is the command from a mac shell:

python3 -m venv venv

Finally, activate your virtual environment:

source venv/bin/activate

3. Install Requirements

Activate your virtual environment and install the required packages using pip:

pip3 install -r requirements.txt

3. Add your API key(s):

Create a file named .env in your project's root directory. Paste your API key(s) inside the file. See .env_sample file for required format.

Running the App

Running Locally

Navigate to your project directory in the terminal and execute the following command to launch the Streamlit app:

streamlit run main.py

This will open the App in your web browser, typically at http://localhost:8501.

Running a Web App

This app is built to be hosted on Streamlit and can be deployed with Streamlit's 3-step deployment process:

  1. Put your app in a public GitHub repo (and make sure it has a requirements.txt!)
  2. Sign into share.streamlit.io
  3. Click 'Deploy an app' and then paste in your GitHub URL

Streamlit is a platform for hosting and sharing web apps. Community (public) apps are free to host. In addition, this template is built using only temporary local storage and no database, for ease of setup and data privacy.

Deployment outside of Streamlit is certainly possible but outside the scope of this README.

Explanation

The app leverages Streamlit to create a user interface and OpenAI's API for interacting with a large language model. Here's a breakdown of the key functionalities:

Customization

The config.py file includes sections for various app aspects you can customize:

Feel free to experiment with these configurations to tailor the app's behavior and appearance to your preferences.