fffiloni commited on
Commit
a91d10a
1 Parent(s): 1a45b80

Update app_text_to_3d.py

Browse files
Files changed (1) hide show
  1. app_text_to_3d.py +9 -21
app_text_to_3d.py CHANGED
@@ -6,31 +6,23 @@ from model import Model
6
  from settings import CACHE_EXAMPLES, MAX_SEED
7
  from utils import randomize_seed_fn
8
 
 
9
 
10
- def create_demo(model: Model) -> gr.Blocks:
11
- examples = [
12
- 'A chair that looks like an avocado',
13
- 'An airplane that looks like a banana',
14
- 'A spaceship',
15
- 'A birthday cupcake',
16
- 'A chair that looks like a tree',
17
- 'A green boot',
18
- 'A penguin',
19
- 'Ube ice cream cone',
20
- 'A bowl of vegetables',
21
- ]
22
 
23
- def process_example_fn(prompt: str) -> str:
24
- return model.run_text(prompt)
25
 
26
  with gr.Blocks() as demo:
27
  with gr.Box():
28
  with gr.Row(elem_id='prompt-container'):
 
29
  prompt = gr.Text(
30
  label='Prompt',
31
  show_label=False,
32
  max_lines=1,
33
- placeholder='Enter your prompt').style(container=False)
 
34
  run_button = gr.Button('Run').style(full_width=False)
35
  result = gr.Model3D(label='Result', show_label=False)
36
  with gr.Accordion('Advanced options', open=False):
@@ -53,12 +45,8 @@ def create_demo(model: Model) -> gr.Blocks:
53
  step=1,
54
  value=64)
55
 
56
- gr.Examples(examples=examples,
57
- inputs=prompt,
58
- outputs=result,
59
- fn=process_example_fn,
60
- cache_examples=CACHE_EXAMPLES)
61
-
62
  inputs = [
63
  prompt,
64
  seed,
 
6
  from settings import CACHE_EXAMPLES, MAX_SEED
7
  from utils import randomize_seed_fn
8
 
9
+ caption = gr.load(name="spaces/fffiloni/CoCa-clone"
10
 
11
+ def create_image_caption():
12
+ return cap
 
 
 
 
 
 
 
 
 
 
13
 
14
+ def create_demo(model: Model) -> gr.Blocks:
 
15
 
16
  with gr.Blocks() as demo:
17
  with gr.Box():
18
  with gr.Row(elem_id='prompt-container'):
19
+ image_init = gr.Image(type="filepath", source="upload")
20
  prompt = gr.Text(
21
  label='Prompt',
22
  show_label=False,
23
  max_lines=1,
24
+ placeholder='Enter your prompt',
25
+ visible=False).style(container=False)
26
  run_button = gr.Button('Run').style(full_width=False)
27
  result = gr.Model3D(label='Result', show_label=False)
28
  with gr.Accordion('Advanced options', open=False):
 
45
  step=1,
46
  value=64)
47
 
48
+
49
+ image_init.change(fn=create_image_caption, inputs=[image_cap], outputs=[prompt])
 
 
 
 
50
  inputs = [
51
  prompt,
52
  seed,