Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,17 @@
|
|
1 |
-
import spaces
|
2 |
import json
|
3 |
import torch
|
4 |
import gradio as gr
|
5 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
6 |
|
7 |
-
title = """# 🙋🏻♂️ Welcome to Tonic's
|
8 |
description = """
|
9 |
-
🎬 Large Action Models (LAMs) are advanced large language models designed to enhance decision-making and translate user intentions into executable actions that interact with the world. LAMs autonomously plan and execute tasks to achieve specific goals, serving as the brains of AI agents. They have the potential to automate workflow processes across various domains, making them invaluable for a wide range of applications.Check our the Salesforce/xLAM models : [🤗 xLAM-1b-fc-r](https://huggingface.co/Salesforce/xLAM-1b-fc-r) | [🤗 xLAM-1b-fc-r-GGUF](https://huggingface.co/Salesforce/xLAM-1b-fc-r-gguf) [🤗 xLAM-7b-fc-r](https://huggingface.co/Salesforce/xLAM-7b-fc-r) | [🤗 xLAM-7b-fc-r-GGUF](https://huggingface.co/Salesforce/xLAM-7b-fc-r-gguf) [🤗 xLAM-7b-r ](https://huggingface.co/Salesforce/xLAM-7b-r) | [🤗 xLAM-8x7b-r](https://huggingface.co/Salesforce/xLAM-8x7b-r) [🤗 xLAM-8x22b-r](https://huggingface.co/Salesforce/xLAM-8x22b-r) |
|
10 |
### Join us :
|
11 |
🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/GWpVpekp) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [Build Tonic](https://git.tonic-ai.com/)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
|
12 |
"""
|
13 |
|
14 |
# Load model and tokenizer
|
15 |
-
model_name = "Salesforce/xLAM-
|
16 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True)
|
17 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
18 |
|
@@ -106,7 +105,6 @@ def build_prompt(task_instruction: str, format_instruction: str, tools: list, qu
|
|
106 |
prompt += build_conversation_history_prompt(conversation_history)
|
107 |
return prompt
|
108 |
|
109 |
-
@spaces.GPU
|
110 |
def generate_response(tools_input, query):
|
111 |
try:
|
112 |
tools = json.loads(tools_input)
|
|
|
|
|
1 |
import json
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
|
6 |
+
title = """# 🙋🏻♂️ Welcome to Tonic's On 📲🎬🦀Device Function Calling"""
|
7 |
description = """
|
8 |
+
📲🎬🦀Salesforce/xLAM-1b-fc-r is on device , meaning you can put it in offline apps and more! 🎬 Large Action Models (LAMs) are advanced large language models designed to enhance decision-making and translate user intentions into executable actions that interact with the world. LAMs autonomously plan and execute tasks to achieve specific goals, serving as the brains of AI agents. They have the potential to automate workflow processes across various domains, making them invaluable for a wide range of applications.Check our the Salesforce/xLAM models : [🤗 xLAM-1b-fc-r](https://huggingface.co/Salesforce/xLAM-1b-fc-r) | [🤗 xLAM-1b-fc-r-GGUF](https://huggingface.co/Salesforce/xLAM-1b-fc-r-gguf) [🤗 xLAM-7b-fc-r](https://huggingface.co/Salesforce/xLAM-7b-fc-r) | [🤗 xLAM-7b-fc-r-GGUF](https://huggingface.co/Salesforce/xLAM-7b-fc-r-gguf) [🤗 xLAM-7b-r ](https://huggingface.co/Salesforce/xLAM-7b-r) | [🤗 xLAM-8x7b-r](https://huggingface.co/Salesforce/xLAM-8x7b-r) [🤗 xLAM-8x22b-r](https://huggingface.co/Salesforce/xLAM-8x22b-r) |
|
9 |
### Join us :
|
10 |
🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/GWpVpekp) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [Build Tonic](https://git.tonic-ai.com/)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
|
11 |
"""
|
12 |
|
13 |
# Load model and tokenizer
|
14 |
+
model_name = "Salesforce/xLAM-1b-fc-r"
|
15 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True)
|
16 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
17 |
|
|
|
105 |
prompt += build_conversation_history_prompt(conversation_history)
|
106 |
return prompt
|
107 |
|
|
|
108 |
def generate_response(tools_input, query):
|
109 |
try:
|
110 |
tools = json.loads(tools_input)
|