Akash473 commited on
Commit
746e5dc
·
verified ·
1 Parent(s): 454fd03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -12,8 +12,9 @@ def format_prompt(message, history):
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,7 +29,7 @@ def generate(
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
@@ -82,13 +83,9 @@ additional_inputs = [
82
  initial_prompt = "Hello John! Welcome to our simulation interview for the Solution Architect position. I understand you may have some initial thoughts or questions about the job requirements. Feel free to share those with me."
83
 
84
  gr.ChatInterface(
85
- generate,
86
- title="""Gen-AIInterviewUseCase featuring Mistral 7B""",
87
- inputs=[
88
- gr.Textbox(
89
- default=initial_prompt, label="Initial Prompt", type="text", key="prompt"
90
- )
91
- ],
92
- outputs=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
93
  additional_inputs=additional_inputs,
 
94
  ).launch(show_api=False)
 
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
  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
 
83
  initial_prompt = "Hello John! Welcome to our simulation interview for the Solution Architect position. I understand you may have some initial thoughts or questions about the job requirements. Feel free to share those with me."
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)