vilarin commited on
Commit
c91d94f
·
verified ·
1 Parent(s): 99c5928

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -112,19 +112,19 @@ def gen(prompt: str, system_prompt: str, token: str, accountId: str):
112
  setAccount(token, accountId)
113
  text = generate_text(prompt, system_prompt)
114
  image = generate_image(str(text))
115
- text = f"Prompt: {prompt}\n\nOptimized Prompt: {text}"
116
  return text, image
117
 
118
  # Gradio Interface
119
  with gr.Blocks(theme="ocean") as demo:
120
- gr.HTML("<h1><center>ImageX</center></h1>")
121
- prompt = gr.Textbox(label='Enter Your Prompt', placeholder="Enter prompt...")
122
  with gr.Row():
123
  sendBtn = gr.Button(variant='primary')
124
  clearBtn = gr.ClearButton([prompt])
125
- gen_text = gr.Textbox(label="Optimization")
126
  gen_img = gr.Image(type="pil", label='Generated Image', height=600)
127
- with gr.Accordion("Advanced Options", open=True):
128
  system_prompt = gr.Textbox(
129
  value = PRESET_PROMPT,
130
  label = "System prompt",
@@ -132,14 +132,16 @@ with gr.Blocks(theme="ocean") as demo:
132
  )
133
  token = gr.Textbox(
134
  label = "API Token",
 
135
  type = "password"
136
  )
137
  accountId = gr.Textbox(
138
  label = "Account ID",
 
139
  type = "password"
140
  )
141
  gr.HTML("""
142
- <p>Powered By Cloudflare Workers AI | <a href="https://github.com/snekkenull/ImageX">Run Locally with Source Code</a></p>
143
  """)
144
 
145
  gr.on(
 
112
  setAccount(token, accountId)
113
  text = generate_text(prompt, system_prompt)
114
  image = generate_image(str(text))
115
+ text = f"Prompt🐴: {prompt}\n\nOptimized Prompt🦄: {text}"
116
  return text, image
117
 
118
  # Gradio Interface
119
  with gr.Blocks(theme="ocean") as demo:
120
+ gr.HTML("<h1><center>ImageX</center></h1><br><center>Please set Your own CF API Token below.🦖</center>")
121
+ prompt = gr.Textbox(label='Enter Your Prompt✏️', placeholder="Enter prompt...")
122
  with gr.Row():
123
  sendBtn = gr.Button(variant='primary')
124
  clearBtn = gr.ClearButton([prompt])
125
+ gen_text = gr.Textbox(label="Optimization🎨")
126
  gen_img = gr.Image(type="pil", label='Generated Image', height=600)
127
+ with gr.Accordion("Advanced Options⚙️", open=True):
128
  system_prompt = gr.Textbox(
129
  value = PRESET_PROMPT,
130
  label = "System prompt",
 
132
  )
133
  token = gr.Textbox(
134
  label = "API Token",
135
+ info = "GEt it From Cloudflare Dashboard->AI->Workers AI->REST API",
136
  type = "password"
137
  )
138
  accountId = gr.Textbox(
139
  label = "Account ID",
140
+ info = "GEt it From Cloudflare Dashboard->AI->Workers AI->REST API",
141
  type = "password"
142
  )
143
  gr.HTML("""
144
+ <p>Powered By <a href="https://dash.cloudflare.com/">Cloudflare Workers AI</a> | <a href="https://github.com/snekkenull/ImageX">Run Locally with Source Code</a></p>
145
  """)
146
 
147
  gr.on(