Spaces:
Running
Running
File size: 1,627 Bytes
13d3de7 |
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 |
from smolagents import CodeAgent, HfApiModel
from transcription_tool import TranscriptTool
from huggingface_hub import login
from config import HUGGINGFACE_API_KEY
login(HUGGINGFACE_API_KEY)
#model = HfApiModel("deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B")
#model = HfApiModel("deepseek-ai/DeepSeek-R1-Zero")
#model = HfApiModel("deepseek-ai/DeepSeek-R1-Distill-Qwen-7B")
#model = HfApiModel("deepseek-ai/deepseek-llm-7b-chat")
model = HfApiModel("HuggingFaceH4/zephyr-7b-alpha")
# Smolagent transcription tool
transcript_tool = TranscriptTool()
agent = CodeAgent(
tools=[transcript_tool],
model=model,
additional_authorized_imports=["string", "subprocess", "librosa", "os", "unicodedata", "datetime", "math", "time", "collections", "random", "itertools"],
)
task = """You are a Python assistant that can use preloaded tools to complete tasks.
A tool named `TranscriptTool` is available for transcription tasks.
To transcribe an audio file:
- Call `TranscriptTool.
- Do not attempt to import or initialize any other class or module for transcription.
do not add any imports
the video file is example_video.mp4
the audio file is example_audio.opus
compare the transcript strings tell me if they are the same
last line of code: final_answer(f"Are transcriptions the same? {video_transcription==audio_transcription}! Video transcription: {video_transcription}, Audio transcription: {audio_transcription}")
"""
result = agent.run(task)
print("Agent Result:", result)
|