bparekh99 commited on
Commit
1a815a6
·
verified ·
1 Parent(s): 80648f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -19,14 +19,13 @@ def get_text_from_url(request: gr.Request):
19
  input_text = params.get("text", "")
20
  return unquote(input_text) # Decode URL-encoded text
21
 
22
- # Gradio Interface with URL handling
23
- demo = gr.Interface(
24
- fn=summarize_text,
25
- inputs=gr.Textbox(lines=5, placeholder="Enter text to summarize..."),
26
- outputs=gr.Textbox(label="Summary"),
27
- title="Text Summarizer using T5",
28
- description="Enter your text and generate a concise summary using the T5 model!",
29
- )
30
 
31
- # Automatically populate text from URL query parameters
32
- demo.load(get_text_from_url, outputs=["textbox"])
 
 
 
19
  input_text = params.get("text", "")
20
  return unquote(input_text) # Decode URL-encoded text
21
 
22
+ # Wrap inside a Blocks container
23
+ with gr.Blocks() as demo:
24
+ textbox = gr.Textbox(lines=5, placeholder="Enter text to summarize...")
25
+ output = gr.Textbox(label="Summary")
26
+ button = gr.Button("Summarize")
 
 
 
27
 
28
+ button.click(summarize_text, inputs=textbox, outputs=output)
29
+ demo.load(get_text_from_url, outputs=textbox) # Now inside Blocks
30
+
31
+ demo.launch()