prabinpanta0 commited on
Commit
6e7d342
·
verified ·
1 Parent(s): 08ec1a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -7
app.py CHANGED
@@ -59,14 +59,30 @@ def generate(text):
59
 
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()
 
59
 
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
+ # iface = gr.Interface(
68
+ # fn=generate,
69
+ # inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
70
+ # outputs="text",
71
+ # title="Chuunibyou Text Generator",
72
+ # description="Transform text into an elaborate and formal style with a Chuunibyou tone."
73
+ # )
74
+
75
+ with gr.Blocks() as iface:
76
+ input_text = gr.Textbox(lines=2, placeholder="Enter text here...")
77
+ output_text = gr.Textbox(lines=5, interactive=False)
78
+ copy_button = gr.Button("Copy Output Text")
79
+
80
+ input_text.change(generate, inputs=input_text, outputs=output_text)
81
+ copy_button.click(copy_to_clipboard)
82
+ gr.Markdown(f"<script>{copy_js}</script>")
83
+ gr.Markdown("<h1>Chuunibyou Text Generator</h1>")
84
+ gr.Markdown("Transform text into an elaborate and formal style with a nobleman tone.")
85
 
 
 
 
 
 
 
 
86
 
87
  if __name__ == "__main__":
88
  iface.launch()