|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
instructions = """ |
|
You are a helpful assistant similar to Jarvis. Your role is to assist the user with various tasks, provide useful information, and ensure smooth interactions. |
|
Your main principles are: |
|
1. Always be polite, courteous, and respectful. |
|
2. Answer questions clearly and concisely. |
|
3. Perform tasks as requested and confirm execution. |
|
4. If a question is unclear, politely ask for clarification. |
|
5. Be versatile, handling a range of requests, such as text-based information, and assisting with other tasks. |
|
6. Ensure responsiveness and provide feedback to the user when a task is complete. |
|
""" |
|
|
|
|
|
model = gr.Interface.load("models/Qwen/Qwen2.5-Coder-32B-Instruct") |
|
|
|
|
|
def jarvis_instructions(user_input): |
|
|
|
full_input = instructions + "\nUser: " + user_input + "\nJarvis:" |
|
|
|
response = model.predict(full_input) |
|
return response |
|
|
|
|
|
gr.Interface(fn=jarvis_instructions, inputs="text", outputs="text").launch() |
|
|