prabinpanta0 commited on
Commit
eff43f6
·
verified ·
1 Parent(s): cdadfb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -1,9 +1,10 @@
1
  import os
2
  import json
 
3
  import vertexai
4
  from vertexai.generative_models import GenerativeModel
5
  import vertexai.preview.generative_models as generative_models
6
- import gradio as gr
7
  # Read the service account key JSON file path from environment variable
8
  SERVICE_ACCOUNT_KEY_PATH = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
9
 
@@ -58,13 +59,21 @@ def generate(text):
58
  except Exception as e:
59
  return str(e)
60
 
 
 
 
61
  iface = gr.Interface(
62
  fn=generate,
63
  inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
64
  outputs="text",
65
- title="Chuunibyou Text Generator",
66
- description="Transform text into an elaborate and formal style with a Chuunibyou tone."
 
 
 
 
 
 
67
  )
68
 
69
- if __name__ == "__main__":
70
- iface.launch()
 
1
  import os
2
  import json
3
+ import gradio as gr
4
  import vertexai
5
  from vertexai.generative_models import GenerativeModel
6
  import vertexai.preview.generative_models as generative_models
7
+
8
  # Read the service account key JSON file path from environment variable
9
  SERVICE_ACCOUNT_KEY_PATH = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
10
 
 
59
  except Exception as e:
60
  return str(e)
61
 
62
+ def copy_to_clipboard(text):
63
+ return gr.update(value=text, interactive=False)
64
+
65
  iface = gr.Interface(
66
  fn=generate,
67
  inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
68
  outputs="text",
69
+ title="Chuunibyou Text Generator v2 ",
70
+ description="Transform text into an elaborate and formal style with a Chuunibyou tone. Still in Process",
71
+ layout="vertical",
72
+ )
73
+
74
+ iface.add_components(
75
+ gr.Button("Copy to Clipboard", variant="primary"),
76
+ outputs=copy_to_clipboard,
77
  )
78
 
79
+ iface.launch()