JustForFunn commited on
Commit
3b21992
·
1 Parent(s): 6e090d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -11
app.py CHANGED
@@ -23,14 +23,25 @@ def process_prompt(prompt):
23
  image_return = model(prompt)
24
  return image_return
25
 
26
- def update_output_text(prompt):
27
- text = generate_text(prompt)
28
- interface.outputs[0].set_text(text)
29
- output_image = process_prompt(text)
30
- interface.outputs[1].set_image(output_image)
31
-
32
- interface = gradio.Interface(fn=update_output_text,
33
- inputs=[gradio.inputs.Textbox(label="Enter Prompt:")],
34
- outputs=[gradio.outputs.Textbox(label="Generated Text"), gradio.outputs.Image(label="Generated Image",type="pil")],
35
- title='AlStable Text to Image')
36
- interface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
23
  image_return = model(prompt)
24
  return image_return
25
 
26
+ # Define the Gradio interface
27
+ prompt_input = Textbox("Enter a prompt", lines=3)
28
+ text_output = Label("")
29
+ image_output = Image()
30
+
31
+ iface = gr.Interface(
32
+ generate_image,
33
+ inputs=prompt_input,
34
+ outputs=[text_output, image_output],
35
+ title="Image Generator",
36
+ description="Generates an image based on a prompt using OpenAI's GPT-3 and DALL-E models."
37
+ )
38
+
39
+ # Update the output boxes with the generated text and image
40
+ def update_text_output(text, image_url):
41
+ text_output.text = text
42
+ text_output.style['font-size'] = '8px' # Change the font size here
43
+
44
+ iface.interface_result_hooks = [update_text_output]
45
+
46
+ # Launch the interface
47
+ iface.launch()