Akash473 commited on
Commit
03cc696
·
verified ·
1 Parent(s): 746e5dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -12,9 +12,8 @@ def format_prompt(message, history):
12
  return prompt
13
 
14
  def generate(
15
- inputs, history, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
16
  ):
17
- initial_prompt = inputs[0]
18
  temperature = float(temperature)
19
  if temperature < 1e-2:
20
  temperature = 1e-2
@@ -29,7 +28,7 @@ def generate(
29
  seed=42,
30
  )
31
 
32
- formatted_prompt = format_prompt(initial_prompt, history)
33
 
34
  stream = client.text_generation(
35
  formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False
@@ -84,8 +83,14 @@ initial_prompt = "Hello John! Welcome to our simulation interview for the Soluti
84
 
85
  gr.ChatInterface(
86
  fn=generate,
87
- inputs=[gr.Textbox(default=initial_prompt, label="Initial Prompt", type="text")],
88
- outputs=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, layout="panel"),
 
 
 
 
 
 
89
  additional_inputs=additional_inputs,
90
  title="""Gen-AIInterviewUseCase featuring Mistral 7B""",
91
  ).launch(show_api=False)
 
12
  return prompt
13
 
14
  def generate(
15
+ prompt, history, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
16
  ):
 
17
  temperature = float(temperature)
18
  if temperature < 1e-2:
19
  temperature = 1e-2
 
28
  seed=42,
29
  )
30
 
31
+ formatted_prompt = format_prompt(prompt, history)
32
 
33
  stream = client.text_generation(
34
  formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False
 
83
 
84
  gr.ChatInterface(
85
  fn=generate,
86
+ inputs=[gr.Textbox(label="Initial Prompt", type="text", default=initial_prompt)],
87
+ outputs=gr.Chatbot(
88
+ show_label=False,
89
+ show_share_button=False,
90
+ show_copy_button=True,
91
+ likeable=True,
92
+ layout="panel",
93
+ ),
94
  additional_inputs=additional_inputs,
95
  title="""Gen-AIInterviewUseCase featuring Mistral 7B""",
96
  ).launch(show_api=False)