Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,8 @@ upscaler = load_tool("diffusers/latent-upscaler-tool")
|
|
9 |
tools = [controlnet_transformer, upscaler ]
|
10 |
|
11 |
# Define the model and tokenizer
|
12 |
-
model = BertModel.from_pretrained('bert-base-uncased')
|
13 |
-
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
|
14 |
|
15 |
# Create the Streamlit app
|
16 |
st.title("Hugging Face Agent")
|
@@ -33,15 +33,15 @@ def handle_submission():
|
|
33 |
# Initialize the agent with the selected tools
|
34 |
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=tools)
|
35 |
|
36 |
-
|
37 |
agent.config.tools = selected_tools
|
38 |
|
39 |
# Process the user's message
|
40 |
-
|
41 |
-
|
42 |
|
43 |
# Display the agent's response
|
44 |
-
response =
|
45 |
st.text(f"{response:.4f}")
|
46 |
|
47 |
# Add the callback function to the Streamlit app
|
|
|
9 |
tools = [controlnet_transformer, upscaler ]
|
10 |
|
11 |
# Define the model and tokenizer
|
12 |
+
#model = BertModel.from_pretrained('bert-base-uncased')
|
13 |
+
#tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
|
14 |
|
15 |
# Create the Streamlit app
|
16 |
st.title("Hugging Face Agent")
|
|
|
33 |
# Initialize the agent with the selected tools
|
34 |
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=tools)
|
35 |
|
36 |
+
# agent.config.tokenizer = tokenizer
|
37 |
agent.config.tools = selected_tools
|
38 |
|
39 |
# Process the user's message
|
40 |
+
# inputs = tokenizer.encode_plus(message, add_special_tokens=True, return_tensors="pt")
|
41 |
+
# outputs = agent(inputs['input_ids'], attention_mask=inputs['attention_mask'])
|
42 |
|
43 |
# Display the agent's response
|
44 |
+
response = agent.run(inputs['input_ids'])
|
45 |
st.text(f"{response:.4f}")
|
46 |
|
47 |
# Add the callback function to the Streamlit app
|