vilarin commited on
Commit
119071f
1 Parent(s): 5aec662

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -2,13 +2,11 @@ import os
2
  import gradio as gr
3
  from cloudflare import Cloudflare
4
  #from typing import List, Union
5
-
6
- client = Cloudflare(api_token=os.environ['CF_API_TOKEN'])
7
-
8
  # set account id and model name
9
- ACCOUNT_ID = os.environ['CF_ACCOUNT_ID']
10
- IMAGE_MODEL = os.environ['CF_IMAGE_MODEL']
11
- CHAT_MODEL = os.environ['CF_CHAT_MODEL']
12
 
13
  PRESET_PROMPT = """
14
  你是一个基于Flux.1模型的提示词生成机器人。根据用户的需求,自动生成符合Flux.1格式的绘画提示词。虽然你可以参考提供的模板来学习提示词结构和规律,但你必须具备灵活性来应对各种不同需求。最终输出应仅限提示词,无需任何其他解释或信息。你的回答必须全部使用英语进行回复我!
@@ -87,6 +85,8 @@ PRESET_PROMPT = """
87
  **你的输出**:A futuristic cityscape at night, in a cyberpunk style, with neon lights reflecting off wet streets, towering skyscrapers, and a glowing, high-tech atmosphere. Dark shadows contrast with vibrant neon signs, creating a dramatic, dystopian mood`
88
  """
89
 
 
 
90
  def generate_image(prompt):
91
  try:
92
  image = client.workers.ai.with_raw_response.run(
@@ -136,8 +136,8 @@ with gr.Blocks(theme="ocean") as demo:
136
  gr.HTML("<h1><center>ImagenX</center></h1>")
137
  gr.HTML("<p><center>Powered By Cloudflare + Gradio</center></p>")
138
  with gr.Row():
139
- gen_text = gr.Markdown(label="Optimized Text")
140
- gen_img = gr.Image(type="pil", label='Generated Image')
141
  with gr.Row():
142
  prompt = gr.Textbox(label='Enter Your Prompt', placeholder="Enter prompt...", scale=6)
143
  sendBtn = gr.Button(variant='primary')
 
2
  import gradio as gr
3
  from cloudflare import Cloudflare
4
  #from typing import List, Union
5
+ API_TOKEN=os.environ.get('CF_API_TOKEN')
 
 
6
  # set account id and model name
7
+ ACCOUNT_ID = os.environ.get('CF_ACCOUNT_ID')
8
+ IMAGE_MODEL = os.environ.get('CF_IMAGE_MODEL')
9
+ CHAT_MODEL = os.environ.get('CF_CHAT_MODEL')
10
 
11
  PRESET_PROMPT = """
12
  你是一个基于Flux.1模型的提示词生成机器人。根据用户的需求,自动生成符合Flux.1格式的绘画提示词。虽然你可以参考提供的模板来学习提示词结构和规律,但你必须具备灵活性来应对各种不同需求。最终输出应仅限提示词,无需任何其他解释或信息。你的回答必须全部使用英语进行回复我!
 
85
  **你的输出**:A futuristic cityscape at night, in a cyberpunk style, with neon lights reflecting off wet streets, towering skyscrapers, and a glowing, high-tech atmosphere. Dark shadows contrast with vibrant neon signs, creating a dramatic, dystopian mood`
86
  """
87
 
88
+ client = Cloudflare(api_token=API_TOKEN)
89
+
90
  def generate_image(prompt):
91
  try:
92
  image = client.workers.ai.with_raw_response.run(
 
136
  gr.HTML("<h1><center>ImagenX</center></h1>")
137
  gr.HTML("<p><center>Powered By Cloudflare + Gradio</center></p>")
138
  with gr.Row():
139
+ gen_text = gr.Markdown(label="Optimized Text", height=600)
140
+ gen_img = gr.Image(type="pil", label='Generated Image', height=600)
141
  with gr.Row():
142
  prompt = gr.Textbox(label='Enter Your Prompt', placeholder="Enter prompt...", scale=6)
143
  sendBtn = gr.Button(variant='primary')