mohamedemam commited on
Commit
804c332
·
1 Parent(s): 9eec36b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -27,11 +27,11 @@ def generate_qa(context, temperature, top_p,numofseq):
27
  output = model.generate(
28
  **input_ids,
29
  temperature=temperature,
30
- top_p=top_p,num_return_sequences=numofseq
31
  )
32
 
33
  generated_text = tokenizer.batch_decode(output, skip_special_tokens=True)
34
- return r"\n".join(generated_text)
35
 
36
  # Create the Gradio interface with sliders for temperature and top-p
37
  iface = gr.Interface(
@@ -43,10 +43,9 @@ iface = gr.Interface(
43
  gr.inputs.Slider(minimum=1, maximum=50, default=1, step=1, label="num_return_sequences")
44
 
45
  ],
46
- outputs="text",
47
  title="Question Generation and Answering",
48
- description="Enter a context, choose a recommended word, and adjust temperature and top-p. The model will generate a question and answer.",
49
- )
50
 
51
 
52
  # Launch the interface
 
27
  output = model.generate(
28
  **input_ids,
29
  temperature=temperature,
30
+ top_p=top_p,num_return_sequences=numofseq,do_sample=True
31
  )
32
 
33
  generated_text = tokenizer.batch_decode(output, skip_special_tokens=True)
34
+ return generated_text
35
 
36
  # Create the Gradio interface with sliders for temperature and top-p
37
  iface = gr.Interface(
 
43
  gr.inputs.Slider(minimum=1, maximum=50, default=1, step=1, label="num_return_sequences")
44
 
45
  ],
46
+ outputs=gr.outputs.Textbox(label="Generated Sentences", type="list"),
47
  title="Question Generation and Answering",
48
+ description="Enter a context, choose a recommended word, adjust temperature and top-p, and set the number of samples. The model will generate questions and answers.",
 
49
 
50
 
51
  # Launch the interface