sc_ma commited on
Commit
a112b24
1 Parent(s): a6aecff

Testing output file error in Spaces.

Browse files
Files changed (3) hide show
  1. app.py +3 -3
  2. auto_backgrounds.py +1 -1
  3. auto_draft.py +1 -1
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import openai
3
  from auto_backgrounds import generate_backgrounds
4
 
5
- # todo:
6
  # 3. create a huggingface space. test it using multiple devices!
7
  # 4. further polish auto_backgrounds.py. Make backgrounds have multiple subsection.
8
  # 5. Design a good layout of huggingface space.
@@ -18,14 +18,14 @@ with gr.Blocks() as demo:
18
  ''')
19
  with gr.Row():
20
  with gr.Column():
21
- title = gr.Textbox(value="Playing Atari Game with Deep Reinforcement Learning", lines=1, max_lines=1, label="Title")
22
  description = gr.Textbox(lines=5, label="Description (Optional)")
23
 
24
  with gr.Row():
25
  clear_button = gr.Button("Clear")
26
  submit_button = gr.Button("Submit")
27
  with gr.Column():
28
- file_output = gr.outputs.File()
29
 
30
  clear_button.click(fn=clear_inputs, inputs=[title, description], outputs=[title, description])
31
  submit_button.click(fn=generate_backgrounds, inputs=[title, description], outputs=file_output)
 
2
  import openai
3
  from auto_backgrounds import generate_backgrounds
4
 
5
+ # todo: bugs. where is my zip file?
6
  # 3. create a huggingface space. test it using multiple devices!
7
  # 4. further polish auto_backgrounds.py. Make backgrounds have multiple subsection.
8
  # 5. Design a good layout of huggingface space.
 
18
  ''')
19
  with gr.Row():
20
  with gr.Column():
21
+ title = gr.Textbox(value="Deep Reinforcement Learning", lines=1, max_lines=1, label="Title")
22
  description = gr.Textbox(lines=5, label="Description (Optional)")
23
 
24
  with gr.Row():
25
  clear_button = gr.Button("Clear")
26
  submit_button = gr.Button("Submit")
27
  with gr.Column():
28
+ file_output = gr.File()
29
 
30
  clear_button.click(fn=clear_inputs, inputs=[title, description], outputs=[title, description])
31
  submit_button.click(fn=generate_backgrounds, inputs=[title, description], outputs=file_output)
auto_backgrounds.py CHANGED
@@ -118,7 +118,7 @@ def generate_backgrounds(title, description="", template="ICLR2022", model="gpt-
118
  print(f"Failed to generate {section} due to the error: {e}")
119
  print(f"The paper {title} has been generated. Saved to {save_to_path}.")
120
  # shutil.make_archive("output.zip", 'zip', save_to_path)
121
- return make_archive(save_to_path, save_to_path+"output.zip")
122
 
123
  if __name__ == "__main__":
124
  title = "Reinforcement Learning"
 
118
  print(f"Failed to generate {section} due to the error: {e}")
119
  print(f"The paper {title} has been generated. Saved to {save_to_path}.")
120
  # shutil.make_archive("output.zip", 'zip', save_to_path)
121
+ return make_archive(save_to_path, "output.zip")
122
 
123
  if __name__ == "__main__":
124
  title = "Reinforcement Learning"
auto_draft.py CHANGED
@@ -132,7 +132,7 @@ def generate_draft(title, description="", template="ICLR2022", model="gpt-4"):
132
  except Exception as e:
133
  print(f"Failed to generate {section} due to the error: {e}")
134
  print(f"The paper {title} has been generated. Saved to {save_to_path}.")
135
- return make_archive(save_to_path, save_to_path+"output.zip")
136
 
137
  if __name__ == "__main__":
138
  # title = "Training Adversarial Generative Neural Network with Adaptive Dropout Rate"
 
132
  except Exception as e:
133
  print(f"Failed to generate {section} due to the error: {e}")
134
  print(f"The paper {title} has been generated. Saved to {save_to_path}.")
135
+ return make_archive(save_to_path, "output.zip")
136
 
137
  if __name__ == "__main__":
138
  # title = "Training Adversarial Generative Neural Network with Adaptive Dropout Rate"