Ujjwal20 commited on
Commit
bfadfaf
·
1 Parent(s): fd76e63
Files changed (1) hide show
  1. app.py +39 -14
app.py CHANGED
@@ -79,22 +79,47 @@ def generate_slogans(brand, description, industry, tone="playful", num=5, liked_
79
 
80
  return {"slogans": slogans[:num * 2]}
81
 
82
- # Minimal Gradio interface (hidden)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  with gr.Blocks() as demo:
84
- gr.Markdown("API only. No interface required.")
85
- # Add an API route
86
- gr.api(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  generate_slogans,
88
- api_name="predict",
89
- inputs=[
90
- gr.Textbox(label="Brand"),
91
- gr.Textbox(label="Description"),
92
- gr.Textbox(label="Industry"),
93
- gr.Dropdown(["playful", "bold", "minimalist", "luxury", "classic"], label="Tone", value="playful"),
94
- gr.Slider(1, 10, value=5, label="Number of Slogans"),
95
- gr.Textbox(label="Generate like this slogan (optional)", value=None)
96
- ],
97
- outputs=gr.JSON(label="Slogans")
98
  )
99
 
100
  demo.launch(show_api=True)
 
79
 
80
  return {"slogans": slogans[:num * 2]}
81
 
82
+ # # Minimal Gradio interface (hidden)
83
+ # with gr.Blocks() as demo:
84
+ # gr.Markdown("API only. No interface required.")
85
+ # # Add an API route
86
+ # gr.api(
87
+ # generate_slogans,
88
+ # api_name="predict",
89
+ # inputs=[
90
+ # gr.Textbox(label="Brand"),
91
+ # gr.Textbox(label="Description"),
92
+ # gr.Textbox(label="Industry"),
93
+ # gr.Dropdown(["playful", "bold", "minimalist", "luxury", "classic"], label="Tone", value="playful"),
94
+ # gr.Slider(1, 10, value=5, label="Number of Slogans"),
95
+ # gr.Textbox(label="Generate like this slogan (optional)", value=None)
96
+ # ],
97
+ # outputs=gr.JSON(label="Slogans")
98
+ # )
99
+
100
+ # Create Gradio interface
101
  with gr.Blocks() as demo:
102
+ # Define inputs
103
+ brand = gr.Textbox(label="Brand")
104
+ description = gr.Textbox(label="Description")
105
+ industry = gr.Textbox(label="Industry")
106
+ tone = gr.Dropdown(
107
+ choices=["playful", "bold", "minimalist", "luxury", "classic"],
108
+ value="playful",
109
+ label="Tone"
110
+ )
111
+ num = gr.Slider(minimum=1, maximum=10, step=1, value=5, label="Number of Slogans")
112
+ liked_slogan = gr.Textbox(label="Generate like this slogan (optional)")
113
+
114
+ # Define output
115
+ output = gr.JSON(label="Generated Slogans")
116
+
117
+ # Create API endpoint
118
+ demo.api(
119
  generate_slogans,
120
+ inputs=[brand, description, industry, tone, num, liked_slogan],
121
+ outputs=output,
122
+ api_name="predict"
 
 
 
 
 
 
 
123
  )
124
 
125
  demo.launch(show_api=True)