Spaces:
Runtime error
Runtime error
prabinpanta0
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -60,36 +60,13 @@ def generate(text):
|
|
60 |
except Exception as e:
|
61 |
return str(e)
|
62 |
|
63 |
-
def copy_to_clipboard(text):
|
64 |
-
pyperclip.copy(text)
|
65 |
-
return "Text copied to clipboard!"
|
66 |
-
|
67 |
-
def update_output_and_copy(text):
|
68 |
-
response_text = generate(text)
|
69 |
-
pyperclip.copy(response_text)
|
70 |
-
return gr.update(value=response_text, visible=True), "Text copied to clipboard!"
|
71 |
-
|
72 |
iface = gr.Interface(
|
73 |
fn=generate,
|
74 |
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
75 |
-
outputs=
|
76 |
title="Chuunibyou Text Generator",
|
77 |
description="Transform text into an elaborate and formal style with a Chuunibyou tone."
|
78 |
)
|
79 |
|
80 |
-
iface_with_button = gr.Blocks()
|
81 |
-
|
82 |
-
with iface_with_button:
|
83 |
-
textbox = gr.Textbox(lines=2, placeholder="Enter text here...")
|
84 |
-
output = gr.Textbox(visible=True)
|
85 |
-
submit_button = gr.Button("Submit")
|
86 |
-
copy_message = gr.Textbox(visible=True)
|
87 |
-
|
88 |
-
submit_button.click(
|
89 |
-
fn=update_output_and_copy,
|
90 |
-
inputs=textbox,
|
91 |
-
outputs=[output, copy_message]
|
92 |
-
)
|
93 |
-
|
94 |
if __name__ == "__main__":
|
95 |
-
|
|
|
60 |
except Exception as e:
|
61 |
return str(e)
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
iface = gr.Interface(
|
64 |
fn=generate,
|
65 |
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
66 |
+
outputs="text",
|
67 |
title="Chuunibyou Text Generator",
|
68 |
description="Transform text into an elaborate and formal style with a Chuunibyou tone."
|
69 |
)
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
if __name__ == "__main__":
|
72 |
+
iface.launch()
|