AMfeta99 commited on
Commit
203d34d
·
verified ·
1 Parent(s): 3545efb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -7,27 +7,22 @@ from gradio_client import Client
7
  class TextToImageTool(Tool):
8
  name = "text_to_image"
9
  description = "Generate an image from a text prompt using m-ric/text-to-image."
10
-
11
- # `inputs` is a dictionary: argument_name -> type
12
- #inputs = {"prompt": str}
13
- #output_type = "image"
14
- #outputs = {"image": "image"} # Optional, type can be a string or class
15
 
16
  inputs = {
17
- "prompt": {"type": "str"} # Must be a dict, not just a type
 
 
 
18
  }
 
19
  output_type = "image"
20
- outputs = {
21
- "image": "image"
22
- }
23
-
24
  def __init__(self):
25
  super().__init__()
26
  self.client = Client("m-ric/text-to-image")
27
 
28
- def run(self, prompt: str):
29
- return self.client.predict(prompt, api_name="/predict") # Returns PIL.Image
30
-
31
 
32
  #%% Utility functions
33
  def add_label_to_image(image, label):
 
7
  class TextToImageTool(Tool):
8
  name = "text_to_image"
9
  description = "Generate an image from a text prompt using m-ric/text-to-image."
 
 
 
 
 
10
 
11
  inputs = {
12
+ "prompt": {
13
+ "type": "str",
14
+ "description": "Text prompt to generate the image"
15
+ }
16
  }
17
+
18
  output_type = "image"
19
+
 
 
 
20
  def __init__(self):
21
  super().__init__()
22
  self.client = Client("m-ric/text-to-image")
23
 
24
+ def run(self, prompt):
25
+ return self.client.predict(prompt, api_name="/predict")
 
26
 
27
  #%% Utility functions
28
  def add_label_to_image(image, label):