Chris4K's picture
Update app.py
933688f verified
raw
history blame
2.02 kB
import streamlit as st
from PIL import Image
from tool_loader import ToolLoader
from app_user_desc import app_user_desc
from app_dev_desc import app_dev_desc
from logger import log_response
from logger import log_enabled
from app_chat import app_chat
import numpy as np
import re,sys,unicodedata
from app_agent_config import AgentConfig
st.set_page_config(
page_title="Custom Transformers can realy do anything...",
page_icon="πŸ‘‹",
)
# Create an instance of AgentConfig
agent_config = AgentConfig()
import streamlit as st
import logging
# Set up the logger
transformers_logger = logging.getLogger("transformers.file_utils")
# Load the logs from the Transformers library
logs = transformers_logger.get_logs()
# Create a Streamlit app
# Add a button to trigger the modal
st.button("Open App User Desc Modal")
# Define a function to display the modal
def display_modal():
# Display the logs in a modal
st.write(logs)
# Add the modal to the app
st.add_modal(display_modal)
#######
import pandas as pd
from io import StringIO
with st.sidebar:
st.header("Set Tools and Option. ")
with st.expander("Configure the agent and activate tools"):
agent_config.configure()
with st.expander("Set Content and Context"):
agent_config.content_and_context()
# Create a page with tabs
tabs = st.tabs(["Chat","User Description"])
with tabs[0]:
st.title("Hugging Face Agent and Tools")
## LB https://huggingface.co/spaces/qiantong-xu/toolbench-leaderboard
st.markdown("Welcome to the Hugging Face Agent and Tools app! This app allows you to interact with various tools using the Hugging Face Inference API. CustomTransformers can do anything \nπŸ€ͺπŸ€—πŸ˜„πŸ€—πŸ€ͺ.")
#st.markdown("Start to chat. e.g. Generate an image of a boat. This will make the agent use the tool text2image to generate an image. Set content, context, Inference URL , tools and logging in the sidebar.")
with tabs[1]:
app_user_desc()
app_chat(agent_config)