File size: 2,023 Bytes
fdfb0c4
cca6750
 
1c5a6c6
 
 
 
 
 
b658652
97ccb9a
365d369
 
 
1c13312
 
 
 
365d369
 
934d9a2
17e8776
933688f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7118235
933688f
 
7118235
d2826a9
 
 
 
 
 
f3a9da9
 
 
2a2c3ec
8f2a15c
d9fa708
 
f3a9da9
8f2a15c
3f91442
235f64d
944514e
2a2c3ec
f3a9da9
 
235f64d
 
 
 
 
 
 
2a2c3ec
 
de95d73
f3a9da9
365d369
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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)