CoolFace
Apppublic

kskkoushik135/codemateTaskplanner

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
app.py31 linesDownload Raw Back to root
1# Use a pipeline as a high-level helper2from transformers import pipeline3import gradio as gr4pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B")5 6 7def call_model(message):8    # Call the model with the messages9    messages = [10    {"role": "user", "content": message},11]12    response = pipe(messages)13    if response and isinstance(response, list) and len(response) > 0 and 'generated_text' in response[0]:14        # Extract and return the generated text string15        return response[0]['generated_text']16    else:17        # Handle cases where the output is not as expected18        return "Error: Could not generate text."19    20 21 22iface = gr.Interface(23    fn=call_model,24    inputs="text",25    outputs="text",26    title="Task planner",27    description="specify a task and the model will generate a plan for you",28)29 30# Launch the Gradio interface31iface.launch()