Tonic commited on
Commit
834cadf
·
1 Parent(s): 0136ef7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -22,12 +22,16 @@ def generate_text(question):
22
  response = tokenizer.decode(tokens[0], skip_special_tokens=True)
23
  return response.split('\nA: ')[-1]
24
 
25
- iface = gr.Interface(
26
- fn=generate_text,
27
- gr.Markdown(title),
28
- gr.Markdown(description),
29
- inputs=gr.Textbox(lines=2, placeholder="Enter your prompt here..."),
30
- outputs="text"
31
- )
 
32
 
 
 
 
33
  iface.launch()
 
22
  response = tokenizer.decode(tokens[0], skip_special_tokens=True)
23
  return response.split('\nA: ')[-1]
24
 
25
+ # Gradio Blocks interface
26
+ with gr.Blocks() as iface:
27
+ gr.Markdown(title)
28
+ gr.Markdown(description)
29
+ with gr.Row():
30
+ question = gr.Textbox(label="Enter your question", lines=2, placeholder="Enter your prompt here...")
31
+ submit_button = gr.Button("Submit")
32
+ output = gr.Textbox(label="Model Response")
33
 
34
+ submit_button.click(fn=generate_text, inputs=question, outputs=output)
35
+
36
+ # Launch the interface
37
  iface.launch()