AMfeta99 commited on
Commit
da48de7
·
verified ·
1 Parent(s): e678869

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -126,13 +126,13 @@ def generate_object_history(object_name):
126
 
127
  gif_path = f"{object_name}_evolution.gif"
128
  images[0].save(gif_path, save_all=True, append_images=images[1:], duration=1000, loop=0)
129
- return [
130
- f"{object_name}_past.png",
131
- f"{object_name}_present.png",
132
- f"{object_name}_future.png"], gif_path
133
- #return [(f"{object_name}_past.png", labels["past"]),
134
- # (f"{object_name}_present.png", labels["present"]),
135
- # (f"{object_name}_future.png", labels["future"])], gif_path
136
  #return images, gif_path
137
 
138
  # =========================================================
@@ -147,23 +147,23 @@ def create_gradio_interface():
147
  and see its past, present, and future visualized with AI!
148
  """)
149
 
150
- #default_images = [
151
- # ("car_past.png", "Car - Past"),
152
- # ("car_present.png", "Car - Present"),
153
- # ("car_future.png", "Car - Future")
154
- #]
155
  default_images = [
156
- "car_past.png",
157
- "car_present.png",
158
- "car_future.png"
159
- ]
 
 
 
 
 
160
  default_gif_path = "car_evolution.gif"
161
 
162
  with gr.Row():
163
  with gr.Column():
164
  object_name_input = gr.Textbox(label="Enter an object name", placeholder="e.g. bicycle, car, phone")
165
  generate_button = gr.Button("Generate Evolution")
166
- image_gallery = gr.Gallery(label="Generated Images", columns=3, rows=1, value=default_images)
167
  #image_gallery = gr.Gallery(label="Generated Images", columns=3, rows=1, type="filepath")
168
  gif_output = gr.Image(label="Generated GIF", value=default_gif_path)
169
 
 
126
 
127
  gif_path = f"{object_name}_evolution.gif"
128
  images[0].save(gif_path, save_all=True, append_images=images[1:], duration=1000, loop=0)
129
+ #return [
130
+ # f"{object_name}_past.png",
131
+ # f"{object_name}_present.png",
132
+ # f"{object_name}_future.png"], gif_path
133
+ return [(f"{object_name}_past.png", labels["past"]),
134
+ (f"{object_name}_present.png", labels["present"]),
135
+ (f"{object_name}_future.png", labels["future"])], gif_path
136
  #return images, gif_path
137
 
138
  # =========================================================
 
147
  and see its past, present, and future visualized with AI!
148
  """)
149
 
 
 
 
 
 
150
  default_images = [
151
+ ("car_past.png", "Car - Past"),
152
+ ("car_present.png", "Car - Present"),
153
+ ("car_future.png", "Car - Future")
154
+ ]
155
+ #default_images = [
156
+ # "car_past.png",
157
+ # "car_present.png",
158
+ # "car_future.png"
159
+ # ]
160
  default_gif_path = "car_evolution.gif"
161
 
162
  with gr.Row():
163
  with gr.Column():
164
  object_name_input = gr.Textbox(label="Enter an object name", placeholder="e.g. bicycle, car, phone")
165
  generate_button = gr.Button("Generate Evolution")
166
+ image_gallery = gr.Gallery(label="Generated Images", columns=3, rows=1, value=default_images, type="filepath" )
167
  #image_gallery = gr.Gallery(label="Generated Images", columns=3, rows=1, type="filepath")
168
  gif_output = gr.Image(label="Generated GIF", value=default_gif_path)
169