prabinpanta0 commited on
Commit
0b50f4e
·
verified ·
1 Parent(s): 320db92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -55
app.py CHANGED
@@ -59,60 +59,14 @@ def generate(text):
59
 
60
  except Exception as e:
61
  return str(e)
62
-
63
- def copy_to_clipboard(text):
64
- pyperclip.copy(generate)
65
- print(pyperclip.paste())
66
- return "Text copied to clipboard!"
67
-
68
- # iface = gr.Interface(
69
- # fn=generate,
70
- # inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
71
- # outputs="text",
72
- # title="Chuunibyou Text Generator",
73
- # description="Transform text into an elaborate and formal style with a Chuunibyou tone."
74
- # )
75
 
76
- # with gr.Blocks() as iface:
77
- # input_text = gr.Textbox(lines=2, placeholder="Enter text here...")
78
- # output_text = gr.Textbox(lines=5, interactive=False)
79
- # copy_button = gr.Button("Copy Output Text")
 
 
 
80
 
81
- # input_text.change(generate, inputs=input_text, outputs=output_text)
82
- # copy_button.click(copy_to_clipboard)
83
- # # gr.Markdown(f"<script>{copy_js}</script>")
84
- # gr.Markdown("<h1>Chuunibyou Text Generator</h1>")
85
- # gr.Markdown("Transform text into an elaborate and formal style with a nobleman tone.")
86
-
87
-
88
- # if __name__ == "__main__":
89
- # iface.launch()
90
-
91
- with gr.Blocks() as demo:
92
- gr.Markdown("# Chuunibyou Text Generator\nTransform text into an elaborate and formal style with a Chuunibyou tone.")
93
- theme=gr.themes.Soft(primary_hue="indigo", secondary_hue="blue", neutral_hue="gray",font=[gr.themes.GoogleFont("Exo"), "ui-sans-serif", "system-ui", "sans-serif"]).set(
94
- body_background_fill_dark="#0f172a",
95
- block_background_fill_dark="#0f172a",
96
- block_border_width="1px",
97
- block_title_background_fill_dark="#070d1b",
98
- input_background_fill_dark="#0c1425",
99
- button_secondary_background_fill_dark="#070d1b",
100
- border_color_accent_dark="#21293b",
101
- border_color_primary_dark="#21293b",
102
- background_fill_secondary_dark="#0f172a",
103
- color_accent_soft_dark="transparent"
104
- ),
105
- with gr.Row():
106
- with gr.Column(scale=2):
107
- input_text = gr.Textbox(lines=2, placeholder="Enter text here...")
108
- output_text = st.code
109
- generate_button = gr.Button("Submit")
110
- # copy_button = gr.Button("Copy Output Text")
111
-
112
- # paste_text = gr.Text(pyperclip.paste())
113
-
114
- generate_button.click(generate, inputs=input_text, outputs=output_text)
115
- # copy_button.click(pyperclip.copy(output_text))
116
-
117
-
118
- demo.launch()
 
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=st.code,
67
+ title="Chuunibyou Text Generator",
68
+ description="Transform text into an elaborate and formal style with a nobleman tone."
69
+ )
70
 
71
+ if __name__ == "__main__":
72
+ iface.launch()