akhaliq HF staff commited on
Commit
3bcc82e
1 Parent(s): fa2ca72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -5,16 +5,19 @@ import os
5
  def generate_image(prompt, api_key):
6
  # Set the API key for the current session
7
  os.environ["REPLICATE_API_TOKEN"] = api_key
 
8
  # Prepare the input for the model
9
  inputs = {
10
  "prompt": prompt,
11
  "prompt_upsampling": True
12
  }
 
13
  # Run the model and get the output URL
14
  output_url = replicate.run(
15
  "black-forest-labs/flux-1.1-pro",
16
  input=inputs
17
  )
 
18
  # Return the generated image URL
19
  return output_url[0]
20
 
@@ -22,7 +25,11 @@ def generate_image(prompt, api_key):
22
  iface = gr.Interface(
23
  fn=generate_image,
24
  inputs=[
25
- gr.Textbox(lines=2, placeholder="Enter your prompt here...", label="Prompt"),
 
 
 
 
26
  gr.Textbox(
27
  lines=1,
28
  placeholder="Enter your Replicate API key...",
 
5
  def generate_image(prompt, api_key):
6
  # Set the API key for the current session
7
  os.environ["REPLICATE_API_TOKEN"] = api_key
8
+
9
  # Prepare the input for the model
10
  inputs = {
11
  "prompt": prompt,
12
  "prompt_upsampling": True
13
  }
14
+
15
  # Run the model and get the output URL
16
  output_url = replicate.run(
17
  "black-forest-labs/flux-1.1-pro",
18
  input=inputs
19
  )
20
+
21
  # Return the generated image URL
22
  return output_url[0]
23
 
 
25
  iface = gr.Interface(
26
  fn=generate_image,
27
  inputs=[
28
+ gr.Textbox(
29
+ lines=2,
30
+ placeholder="Enter your prompt here...",
31
+ label="Prompt"
32
+ ),
33
  gr.Textbox(
34
  lines=1,
35
  placeholder="Enter your Replicate API key...",