ashutoshzade commited on
Commit
cd35815
·
1 Parent(s): 4fefd0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -10
app.py CHANGED
@@ -1,16 +1,24 @@
1
  import gradio as gr
2
 
3
- def greet(name, is_morning, temperature):
4
- salutation = "Good morning" if is_morning else "Good evening"
5
- greeting = f"{salutation} {name}. It is {temperature} degrees today"
6
- celsius = (temperature - 32) * 5 / 9
7
- return greeting, round(celsius, 2)
8
 
9
- demo = gr.Interface(
10
- fn=greet,
11
- inputs=["text", "checkbox", gr.Slider(0, 100)],
12
- outputs=["text", "number"],
 
 
 
 
 
 
13
  )
14
 
15
- demo.launch()
 
 
 
16
 
 
1
  import gradio as gr
2
 
3
+ def generate_text(input_text):
4
+ # Process the input text (your logic goes here)
5
+ # For demonstration purposes, simply return the input text
6
+ return input_text
 
7
 
8
+ def clear_text(input_text):
9
+ # Logic for clearing the text (e.g., returning an empty string)
10
+ return ""
11
+
12
+ iface = gr.Interface(
13
+ fn=generate_text,
14
+ inputs=gr.inputs.Textbox(prompt="Enter website address", lines=5, placeholder="Enter text here..."),
15
+ outputs=gr.outputs.Textbox(label="Generated Text", lines=5),
16
+ title="Text Generator",
17
+ theme="compact"
18
  )
19
 
20
+ # Adding an additional input for clearing text
21
+ iface.add_input("textbox", label="Clear", type="textbox", lines=1, placeholder="Clear text")
22
+
23
+ iface.launch()
24