siddhartharya commited on
Commit
001abb9
·
verified ·
1 Parent(s): 2259d36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -28,19 +28,21 @@ def generate_email(name, project, key_benefits):
28
  return f"An error occurred: {str(e)}"
29
 
30
  # Create Gradio interface
31
- iface = gr.Interface(
32
- fn=generate_email,
33
- inputs=[
34
- gr.Textbox(label="Your Name", placeholder="Enter your name"),
35
- gr.Textbox(label="Project Name", placeholder="Enter the project name"),
36
- gr.Textbox(label="Key Benefits", placeholder="List key benefits, separated by commas")
37
- ],
38
- outputs=gr.Textbox(label="Generated Email"),
39
- title="Email Generator",
40
- description="Generate a personalized email based on the given inputs.",
41
- theme="default",
42
- css=".gradio-container {max-width: 800px; margin: auto;}"
43
- )
 
 
44
 
45
  # Launch the app
46
- iface.launch()
 
28
  return f"An error occurred: {str(e)}"
29
 
30
  # Create Gradio interface
31
+ with gr.Blocks() as demo:
32
+ gr.Markdown("# Email Generator")
33
+ gr.Markdown("Generate a personalized email based on the given inputs.")
34
+
35
+ with gr.Row():
36
+ with gr.Column():
37
+ name = gr.Textbox(label="Your Name", placeholder="Enter your name")
38
+ project = gr.Textbox(label="Project Name", placeholder="Enter the project name")
39
+ benefits = gr.Textbox(label="Key Benefits", placeholder="List key benefits, separated by commas")
40
+ submit_btn = gr.Button("Generate Email")
41
+
42
+ with gr.Column():
43
+ output = gr.Textbox(label="Generated Email", lines=10)
44
+
45
+ submit_btn.click(generate_email, inputs=[name, project, benefits], outputs=output)
46
 
47
  # Launch the app
48
+ demo.launch()