Instructions to use easytt1178/example-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use easytt1178/example-model with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("easytt1178/example-model", device_map="auto") - Notebooks
- Google Colab
- Kaggle
easytt1178 commited on
Commit ·
bb6e1c1
1
Parent(s): fc2ef27
feat: scaffold 5-agent orchestrator with Gradio UI
Browse filesFiles changed (8)
- README.md+12
- app.pyAdded+53
- requirements.txtAdded+4
- src/agents/bot_agent.pyAdded+74
- src/agents/code_agent.pyAdded+26
- src/agents/reasoning_agent.pyAdded+13
- src/agents/vision_agent.pyAdded+25
- src/orchestrator.pyAdded+21
28 unmodified lines29303132333428 unmodified lines# model = AutoModel.from_pretrained("easytt1178/example-model")```## Training Data and Evaluation- Describe datasets, preprocessing, metrics, and evaluation results.28 unmodified lines29303132333435363738394041424344454628 unmodified lines# model = AutoModel.from_pretrained("easytt1178/example-model")```## Multi-Agent Orchestrator (Local)- Requirements: `pip install -r requirements.txt`- Set token (for HF Inference API): `$env:HF_TOKEN = "hf_..."`- Run UI: `python app.py` then open the shown URL.Agents- Code: generate code via HF Inference API- Vision: text-to-image via HF Inference API- Bot: scaffolds Telegram/Discord bots- Reasoning: simple planning steps## Training Data and Evaluation- Describe datasets, preprocessing, metrics, and evaluation results.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253import osimport gradio as grfrom PIL import Imagefrom src.orchestrator import run_task
def ui_generate_code(prompt, language): return run_task("code", {"prompt": prompt, "language": language})
def ui_generate_image(prompt): img = run_task("image", {"prompt": prompt}) return img
def ui_create_bot(bot_type): path = run_task("bot", {"bot_type": bot_type}) return f"Created bot template at: {path}"
def ui_plan(goal): steps = run_task("plan", {"goal": goal}) return "\n".join(f"- {s}" for s in steps)
with gr.Blocks(title="Multi-Agent Orchestrator") as demo: gr.Markdown("# Multi-Agent: Code, Vision, Bot, Reasoning")
with gr.Tab("Code"): prompt = gr.Textbox(label="What to build?", lines=6) lang = gr.Dropdown(choices=["python", "javascript", "typescript", "go", "rust"], value="python", label="Language") out = gr.Code(language="python", label="Generated Code") gr.Button("Generate").click(ui_generate_code, inputs=[prompt, lang], outputs=out)
with gr.Tab("Image"): iprompt = gr.Textbox(label="Image prompt", lines=3) img = gr.Image(type="pil", label="Output") gr.Button("Generate Image").click(ui_generate_image, inputs=[iprompt], outputs=img)
with gr.Tab("Bot"): btype = gr.Dropdown(choices=["telegram", "discord"], value="telegram", label="Bot type") bot_out = gr.Textbox(label="Result") gr.Button("Create Bot Template").click(ui_create_bot, inputs=[btype], outputs=bot_out)
with gr.Tab("Reasoning / Plan"): goal = gr.Textbox(label="Goal description", lines=4) plan_out = gr.Textbox(label="Plan") gr.Button("Make Plan").click(ui_plan, inputs=[goal], outputs=plan_out)
if __name__ == "__main__": # Expect HF_TOKEN to be set for InferenceClient usage. demo.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", "7860")))1234huggingface_hub>=0.24.6gradio>=4.40.0Pillow>=10.4.0transformers>=4.44.21234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374import os
TELEGRAM_TEMPLATE = """"""import osimport loggingfrom telegram import Updatefrom telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes
TOKEN = os.getenv("TELEGRAM_TOKEN")
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text("Hello! I'm your assistant bot.")
async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text(update.message.text)
def main(): if not TOKEN: raise RuntimeError("Set TELEGRAM_TOKEN env var") app = Application.builder().token(TOKEN).build() app.add_handler(CommandHandler("start", start)) app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, echo)) app.run_polling()
if __name__ == "__main__": main()""""""
DISCORD_TEMPLATE = """"""import osimport discord
TOKEN = os.getenv("DISCORD_TOKEN")intents = discord.Intents.default()intents.message_content = Trueclient = discord.Client(intents=intents)
@client.eventasync def on_ready(): print(f"Logged in as {client.user}")
@client.eventasync def on_message(message: discord.Message): if message.author == client.user: return if message.content.startswith("!ping"): await message.channel.send("pong")
def main(): if not TOKEN: raise RuntimeError("Set DISCORD_TOKEN env var") client.run(TOKEN)
if __name__ == "__main__": main()""""""
def create_bot(bot_type: str, output_dir: str = "bots") -> str: os.makedirs(output_dir, exist_ok=True) if bot_type == "telegram": path = os.path.join(output_dir, "telegram_bot.py") with open(path, "w", encoding="utf-8") as f: f.write(TELEGRAM_TEMPLATE) return path elif bot_type == "discord": path = os.path.join(output_dir, "discord_bot.py") with open(path, "w", encoding="utf-8") as f: f.write(DISCORD_TEMPLATE) return path else: raise ValueError("Unsupported bot_type. Use 'telegram' or 'discord'.")1234567891011121314151617181920212223242526from typing import Optionalfrom huggingface_hub import InferenceClientimport os
DEFAULT_MODEL = os.environ.get("HF_CODE_MODEL", "HuggingFaceH4/zephyr-7b-beta")
def generate_code(prompt: str, language: str = "python", max_new_tokens: int = 512) -> str: """Generate code or technical text via HF Inference API.
Falls back to a simple template if API call fails. """ client = InferenceClient(token=os.environ.get("HF_TOKEN")) system_hint = f"You are an expert {language} code assistant. Output only code unless explanation is requested." full_prompt = f"{system_hint}\nTask: {prompt}\nLanguage: {language}" try: text = client.text_generation( model=DEFAULT_MODEL, prompt=full_prompt, max_new_tokens=max_new_tokens, temperature=0.2, ) return text.strip() except Exception as e: return f"# Fallback template due to API error: {e}\nprint('Hello from {language} generator')\n"12345678910111213from typing import List
def plan_tasks(goal: str) -> List[str]: """Very simple planner that decomposes a goal into actionable steps.""" steps = [ f"Clarify goal: {goal}", "Identify inputs, outputs, constraints", "Choose tool/model per subtask", "Draft solution and validate against constraints", "Iterate fixes and produce final output", ] return steps12345678910111213141516171819202122232425from typing import Optionalfrom huggingface_hub import InferenceClientfrom PIL import Imageimport ioimport os
TEXT_TO_IMAGE_MODEL = os.environ.get("HF_IMAGE_MODEL", "stabilityai/stable-diffusion-2-1")
def generate_image(prompt: str, guidance_scale: float = 7.5, num_inference_steps: int = 30) -> Image.Image: """Generate an image from text using HF Inference API.""" client = InferenceClient(token=os.environ.get("HF_TOKEN")) try: img_bytes = client.text_to_image( model=TEXT_TO_IMAGE_MODEL, prompt=prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps, ) return Image.open(io.BytesIO(img_bytes)) except Exception as e: # Return a placeholder image img = Image.new("RGB", (512, 512), color=(240, 240, 240)) return img123456789101112131415161718192021from typing import Literal, Dict, Anyfrom src.agents.code_agent import generate_codefrom src.agents.vision_agent import generate_imagefrom src.agents.bot_agent import create_botfrom src.agents.reasoning_agent import plan_tasks
TaskType = Literal["code", "image", "bot", "plan"]
def run_task(task_type: TaskType, payload: Dict[str, Any]): if task_type == "code": return generate_code(payload.get("prompt", ""), payload.get("language", "python")) elif task_type == "image": return generate_image(payload.get("prompt", "")) elif task_type == "bot": return create_bot(payload.get("bot_type", "telegram")) elif task_type == "plan": return plan_tasks(payload.get("goal", "")) else: raise ValueError("Unsupported task type")README.md+12
app.pyAdded+53
requirements.txtAdded+4
src/agents/bot_agent.pyAdded+74
src/agents/code_agent.pyAdded+26
src/agents/reasoning_agent.pyAdded+13
src/agents/vision_agent.pyAdded+25
src/orchestrator.pyAdded+21