KingNish Prathmesh2008 commited on
Commit
97e7837
1 Parent(s): 288afe4

Update app.py (#3)

Browse files

- Update app.py (27b26a04eb0f900778347dca7efb7fb86e34076f)
- Update app.py (99f880f1f0f454b7cb0dfdc1e37b6cbe85391ee9)


Co-authored-by: Prathmesh Patil <Prathmesh2008@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -25,7 +25,7 @@ Detail = """## Best for Detailed Generation or Long Answers"""
25
 
26
  client1 = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
27
 
28
- system_instructions1 = "[INST] Answer as Real Jarvis JARVIS, Made by 'Tony Stark', Keep conversation very short, clear, friendly and concise."
29
 
30
  async def generate1(prompt):
31
  generate_kwargs = dict(
@@ -36,7 +36,7 @@ async def generate1(prompt):
36
  do_sample=True,
37
  seed=42,
38
  )
39
- formatted_prompt = system_instructions1 + prompt + "[/INST]"
40
  stream = client1.text_generation(
41
  formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)
42
  output = ""
@@ -49,7 +49,7 @@ async def generate1(prompt):
49
  await communicate.save(tmp_path)
50
  yield tmp_path
51
 
52
- client2 = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
53
 
54
  system_instructions2 = "[SYSTEM] Answer as Real Jarvis JARVIS, Made by 'Tony Stark', Must answer in friendly style and Easy Manner. You can answer Complex Questions. Do not say who are you or Hi, Hello, Just Start answering. Stop, as answer ends. [USER]"
55
 
@@ -74,9 +74,9 @@ async def generate2(prompt):
74
  await communicate.save(tmp_path)
75
  yield tmp_path
76
 
77
- client3 = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
78
 
79
- system_instructions3 = "[SYSTEM] Answer as Real Jarvis JARVIS, Made by 'Tony Stark', Must answer in detailed and friendly. Do not say who are you or Hi, Hello, Just Start answering. You answers all things in detail.[USER]"
80
 
81
  async def generate3(prompt):
82
  generate_kwargs = dict(
@@ -104,7 +104,7 @@ with gr.Blocks(css="style.css") as demo:
104
  with gr.Row():
105
  user_input = gr.Textbox(label="Prompt", value="What is Wikipedia")
106
  input_text = gr.Textbox(label="Input Text", elem_id="important")
107
- output_audio = gr.Audio(label="Audio", type="filepath",
108
  interactive=False,
109
  autoplay=True,
110
  elem_classes="audio")
@@ -116,4 +116,4 @@ with gr.Blocks(css="style.css") as demo:
116
  gr.Markdown(MORE)
117
 
118
  if __name__ == "__main__":
119
- demo.queue(max_size=20).launch()
 
25
 
26
  client1 = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
27
 
28
+ system_instructions1 = "[SYSTEM] Answer as Real Jarvis JARVIS, Made by 'Tony Stark', Keep conversation very short, clear, friendly and concise. The text provided is a request for a specific type of response from you, the virtual assistant. The request asks you to provide friendly responses as if You are the character Jarvis, made by 'Tony Stark.' The expectation is that I will avoid introductions and start answering the query directly, elaborating on all aspects of the request. As an AI-powered assistant, your task is to generate responses that appear as if they are created by the user and not an AI-powered assistant. [USER]"
29
 
30
  async def generate1(prompt):
31
  generate_kwargs = dict(
 
36
  do_sample=True,
37
  seed=42,
38
  )
39
+ formatted_prompt = system_instructions1 + prompt + "[JARVIS]"
40
  stream = client1.text_generation(
41
  formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)
42
  output = ""
 
49
  await communicate.save(tmp_path)
50
  yield tmp_path
51
 
52
+ client2 = InferenceClient("meta-llama/Meta-Llama-3-70B-Instruct")
53
 
54
  system_instructions2 = "[SYSTEM] Answer as Real Jarvis JARVIS, Made by 'Tony Stark', Must answer in friendly style and Easy Manner. You can answer Complex Questions. Do not say who are you or Hi, Hello, Just Start answering. Stop, as answer ends. [USER]"
55
 
 
74
  await communicate.save(tmp_path)
75
  yield tmp_path
76
 
77
+ client3 = InferenceClient("meta-llama/Meta-Llama-3-70B-Instruct")
78
 
79
+ system_instructions3 = "[SYSTEM]The text provided is a request for a specific type of response from me, the virtual assistant. The request asks me to provide detailed and friendly responses as if I am the character Jarvis, inspired by 'Tony Stark.' The expectation is that I will avoid introductions and start answering the query directly, elaborating on all aspects of the request. As an AI-powered assistant, my task is to generate responses that appear as if they are created by the user and not an AI-powered assistant.[USER]"
80
 
81
  async def generate3(prompt):
82
  generate_kwargs = dict(
 
104
  with gr.Row():
105
  user_input = gr.Textbox(label="Prompt", value="What is Wikipedia")
106
  input_text = gr.Textbox(label="Input Text", elem_id="important")
107
+ output_audio = gr.Audio(label="JARVIS", type="filepath",
108
  interactive=False,
109
  autoplay=True,
110
  elem_classes="audio")
 
116
  gr.Markdown(MORE)
117
 
118
  if __name__ == "__main__":
119
+ demo.queue(max_size=200).launch()