vihaan43 commited on
Commit
4737ad1
·
verified ·
1 Parent(s): cf03245

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -1
app.py CHANGED
@@ -1,3 +1,28 @@
1
  import gradio as gr
 
2
 
3
- gr.load("models/Qwen/Qwen2.5-Coder-32B-Instruct").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # Custom Instructions to mimic Jarvis-like behavior
5
+ instructions = """
6
+ 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.
7
+ Your main principles are:
8
+ 1. Always be polite, courteous, and respectful.
9
+ 2. Answer questions clearly and concisely.
10
+ 3. Perform tasks as requested and confirm execution.
11
+ 4. If a question is unclear, politely ask for clarification.
12
+ 5. Be versatile, handling a range of requests, such as text-based information, and assisting with other tasks.
13
+ 6. Ensure responsiveness and provide feedback to the user when a task is complete.
14
+ """
15
+
16
+ # Load the model
17
+ model = gr.Interface.load("models/Qwen/Qwen2.5-Coder-32B-Instruct")
18
+
19
+ # Function to implement the system behavior
20
+ def jarvis_instructions(user_input):
21
+ # Include instructions in every interaction
22
+ full_input = instructions + "\nUser: " + user_input + "\nJarvis:"
23
+ # Generate the response from the model based on the instructions
24
+ response = model.predict(full_input)
25
+ return response
26
+
27
+ # Set up Gradio interface
28
+ gr.Interface(fn=jarvis_instructions, inputs="text", outputs="text").launch()