Spaces:
Runtime error
Runtime error
Initial UI skeleton
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def choosistant(review_text,procon='Benefits'):
|
4 |
+
if procon == 'Benefits':
|
5 |
+
return review_text[0:4]
|
6 |
+
elif procon == 'Drawbacks':
|
7 |
+
return review_text[-4:]
|
8 |
+
else:
|
9 |
+
return "Select whether to see either benefits or drawbacks of this product."
|
10 |
+
|
11 |
+
options = ['Benefits','Drawbacks']
|
12 |
+
|
13 |
+
demo = gr.Blocks()
|
14 |
+
with demo:
|
15 |
+
text_input = gr.Textbox(lines=8,placeholder="Enter the review text here...",label="Review Text")
|
16 |
+
|
17 |
+
text_options = gr.Dropdown(options, label="Pros/Cons")
|
18 |
+
b1 = gr.Button("Submit")
|
19 |
+
|
20 |
+
new_title = gr.Textbox(label="Here you go!")
|
21 |
+
b1.click(choosistant, inputs=[text_input,text_options], outputs=new_title)
|
22 |
+
demo.launch()
|